<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>
In Local Variable Words in Local Variables Library
Declares a list of local variables.
: TEST ( n1 n2 -- ) LOCALS{ LV1 LV2 } SET LV2 \ take n2 (top of stack) and put in local variable LV2 SET LV1 \ take n1 (now on top of stack) and put in local variable LV1 ." LV1=" LV1 . CR ." LV2=" LV2 . CR ;
Local variables within a colon definition are defined, by name using the word LOCALS{. Local variable names must be separated with at least one space character.
LOCALS{
Local variable declaration is ended with the word }. There must be a space between the last local variable name and the word }.
}