Scope modifiers: Difference between revisions

adding MUMPS example
(+Icon+Unicon)
(adding MUMPS example)
Line 221:
end
</lang>
=={{header|MUMPS}}==
MUMPS variable can be in a local scope if they are declared as NEW within a subroutine. Otherwise variables are accessible to all levels.
<lang MUMPS>OUTER
SET OUT=1,IN=0
WRITE "OUT = ",OUT,!
WRITE "IN = ",IN,!
DO INNER
WRITE:$DATA(OUT)=0 "OUT was destroyed",!
QUIT
INNER
WRITE "OUT (inner scope) = ",OUT,!
WRITE "IN (outer scope) = ",IN,!
NEW IN
SET IN=3.14
WRITE "IN (inner scope) = ",IN,!
KILL OUT
QUIT</quit>
Execution:<pre>
USER>D ^SCOPE
OUT = 1
IN = 0
OUT (inner scope) = 1
IN (outer scope) = 0
IN (inner scope) = 3.14
OUT was destroyed</pre>
 
=={{header|Perl}}==