Funny programming language in snap! (Part 3)

FizzBuzz program written in ESL:

create script variable "i"
repeat [[
change "i" by 1
if ((([i] mod 5) = 0) and (([i] mod 3) = 0))[[
display "FizzBuzz"
wait for 0.5 seconds
]] else [[
if (([i] mod 3) = 0)[[
display "Fizz"
wait for 0.5 seconds
]] else [[
if (([i] mod 5) = 0)[[
display "Buzz"
wait for 0.5 seconds
]] else [[
display i
]]]] for 100 times

Do not forget to put Indents(preferablly 4 spaces)

create script variable "i"
repeat [[
    change "i"
    if ((([i] mod 5) = 0) and (([i] mod 3) = 0))[[
        display "FizzBuzz"
        wait for 0.5 seconds
    ]] else [[
        if (([i] mod 3) = 0)[[
          display "Fizz"
        wait for 0.5 seconds
    ]] else [[
         if (([i] mod 5) = 0)[[
            display "Buzz"
            wait for 0.5 seconds
    ]] else [[
     display i
]]]] for 100 times

(yes I do know it looks like python)

Yikes, it's not very easy to read, either, even with the indents...

Also, If you want to make an variable for an object, do this.

create (OBJECT NAME) variable "i"

again, loops use { and }, also there is no need for all those parentheses, but you should be able to do it if you want.

Easy Read format:

make a variable called "x" for script -- the "x" variable is null currently
change "x" to 0
repeat this 100 times {
    change [x] to [x]+1 -- change by 1
    if [x] mod 5 = 0 and I mod 3 = 0 then{
        display "FizzBuzz"
    if not then{
         if [x] mod 3 then{
             display "Fizz"
    if not that then{
        if [x] mod 5 then{
            display "Buzz"
   if not then{
        display(x)

Is it any more readable?

A little bit, yeah.

Aargh, don't make the big Python mistake of making the spacing part of the syntax. Someone else edits the code using a different editor and the spacing gets messed up.

I think what started the formal theory of syntax is that in the first version of Algol they had
if A then if B then C else D as legal syntax until they discovered that that's ambiguous.

??? What do you mean?

edited.
the interpreter would ignore spaces at the end of the line if it is not an input.
math expressions would have to use parentheses, see

https://snap.berkeley.edu/snap/help/SnapManual.pdf#page=80

Well, if A then if B then C else D is ambiguous -- is it if A then (if B then C) else D or is it if A then (if B then C else D)? In the first case, if A is false then you always do D; in the second case both A and B have to be false in order to get D.

Sensible languages solve this problem with some kind of bracketing. It doesn't matter whether you use parentheses or brackets or braces, but something. Some languages even use endif to close an if. Python reinvented the terrible idea, which comes along every 20 years or so, of using indentation as the bracketing mechanism. That works until you need to change the structure of a deeply-nested chunk of code, or not even deeply nested but just too long to fit on your screen at once.

These are different syntaxes, but here's what they represent in Snap!:
change "x" to image
change [x] to image

 set "x" to . . . 

It should also just ignore spaces in general, unless they're in strings or something.

right.

I guess the Indents would just be for a readable format.

it should be

change [x] by 1

No, it should be

change "x" by 1

[x] mod 5 is NOT a predicate. The result would be falsey (0), but you should then put 'not' before:

if not ([x] mod 5) then

so if

"hi"

is a string, then

'A'

is a character