Dynamic variable names: Difference between revisions

Line 1,178:
the above creates a variable which is visible only inside the evaluated block (which is considered good style). It will not be visible outside.
 
A bad style alternative which creates a globally visible variable in the Smalltalk namespace (and whichis therefore is visible everywhere) is:
<lang smalltalk>| varName |
varName := Stdin request: 'Enter a global variable name:'.
Anonymous user