evylang / todo

0 stars 0 forks source link

Document if, for, while and numeric range in spec #89

Open juliaogris opened 3 months ago

juliaogris commented 3 months ago

Add specification of if, for and while statements.

if: document nested if's and what the else binds to. document if else

There are 3 types of for ... range statements, to be spec'ed more clearly:

There is an arguable inconsistency with for ... range: numeric step range: Evaluated once at beginning (similar to python) arrays / maps: can be modified while iterating over them and may change iteration count, map example

numeric step range results may appear confusing for (see discord discussion ):

x := 1
for i := range x-1 x+5 1
    x = x + 1
    print i
end
print "\nx: " x
Rossiar commented 2 months ago

We should also add a 4th case for ranging over a string, which is also currently missing from the syntax by example