Scope/Function names and labels: Difference between revisions

m
mNo edit summary
Line 437:
 
=={{header|Julia}}==
In Julia, there is one type of global scope, defined as the scope of the individual module (there is no global scope above module scope). User code not defined within a specific module has global scope within the predefined default module main. There are two types of local or nonglobal scope in Julia: hard local scope, which is the scope of variables defined within functions, and the "soft" local scope of variables within code structures, as quoted below from Julia's documentation:
In Julia, there is one type of global scope, defined as the scope of the individual module
(there is no global scope above module scope). User code not defined within a specific
module has global scope within the predefined default module main.
<br />
There are two types of local or nonglobal scope in Julia:
hard local scope, which is the scope of variables defined within functions, and the
"soft" local scope of variables within code structures, as quoted below from Julia's documentation:
<pre>
Type of scope | block/construct introducing this kind of scope
----------------------------------------------------------------
Global Scope | module, baremodule, at interactive prompt (REPL)
Local Scope | Soft Local Scope: for, while, comprehensions, try-catch-finally, let
Local Scope | Hard Local Scope: functions (either syntax, anonymous & do-blocks), struct, macro
</pre>
Hard local scope means that a variable defined within a function defaults to being local to
4,102

edits