RosettaCodeData/Task/Integer-sequence/M2000-Interpreter/integer-sequence.m2000

24 lines
972 B
Plaintext

\\ easy way
a=1@
\\ Def statement defines one time (second pass produce error)
Rem : Def Decimal a=1
Rem : Def a as decimal=1
\\ Global shadow any global with same name, but not local
\\ globals can change type, local can't change
\\ to assign value to global need <=
\\ Symbol = always make local variables (and shadows globals)
Rem : Global a as decimal =1
\\Local make a new local and shadow one with same name
Rem : Local a as decimal=1
\\ we can create an "auto rounding" variable
\\ an integer with any type (double, single, decimal, currency, long, integer)
\\ rounding to .5 : up for positive numbers and down to negative
\\ 1.5 round to 2 and -1.5 round to -2
a%=1@
\\ variables a, a%, a$, arrays/functions a(), a$(), sub a() and the module a can exist together
\\ A block may act as loop structure using an internal flag
\\ A Loop statement mark a flag in the block, so can be anywhere inside,
\\ this flag reset to false before restart.
{loop : Print a : a++}