A variable holds a value. To define a variable, just assign a value to it.
Yewslip>x = 42 /* global */
An undefined variable has the value of
Variables may be global or local. Global variables are those defined outside of functions. Local variables are those defined in functions. Local variables are specific to each function call, they disappear after the function returns. Global variables are accessible in all functions.
...>y = 17 /* local */
...>print x, y
...>x += 1
Yewslip>print x, y
There is no way to use a local variable with the same name as a global variable. That is why there are so few predefined global variables. They are:
lib. This also means that you must be careful which global variables you define.
A useful construct to do something without defining global variables is:
This wraps the statements into a function and calls it once.