LOCAL

Synopsis
LOCAL varname
LOCAL varnamelist
(LOCAL varname1 varname2 ...)
Description

Creates variables that are local to the currently running procedure. LOCAL accepts as input one or more words, or a list of words. A local variable is created for each of these words, with that word as its name. Logo variables follow dynamic scope rules; a variable that is local to a procedure is available to any sub procedure invoked by that procedure and may shadow a global variable by the same name. The variables created by LOCAL have no initial value; they must be assigned a value (for example, with MAKE) before the procedure attempts to read their value.

Example
TO FOO
  MAKE "bar 1
  PRINT :bar
END

FOO
1

SHOW :bar
1

TO ABC
  LOCAL "xyz
  MAKE "xyz 1
  PRINT :xyz
END

ABC
1

SHOW :xyz
xyz has no value

SourceForge.net Logo