Scope modifiers: Difference between revisions

Content deleted Content added
moved entries around to make the "R" languages in alphabetical order. -- ~~~~
m Added Erlang
Line 242:
 
Names declared with 'private' modifier are not visible outside of a module. All other bindings are visible and can be imported. It is an error to use 'private' modifier on local bindings.
 
=={{header|Erlang}}==
Erlang is lexically scoped. Variables, which must begin with an upper case letter, are only available inside their functions. Functions are only available inside their modules. Unless they are exported.
<lang Erlang>
-module( a_module ).
 
-export( [double/1] ).
 
double( N ) -> add( N, N ).
 
 
 
add( N, N ) -> N + N.
</lang>
 
{{out}}
<pre>
3> a_module:double( 3 ).
6
4> a_module:add( 3, 3 ).
** exception error: undefined function a_module:add/2
</pre>
 
=={{header|Go}}==