well in your version, it's possible for both
IF statements to be
true, which will make the value of
S flip/flop from 1 to 0 then back to 1 again..
; Here's we compare S to 1,
if s = 1
; when S ='s 1 then we're setting S to zero
s = 0
print "S=0"
endif
; Now we're comparing S to zero
if s = 0
; when it's zero it'll set S back to one
s = 1
print "S=1"
endif
Sync
Wait Key
I suspect, you might have been thinking that the second IF/ENDIF will be ignored when the first IF/ENDIF executes. Not the case, the language will execute them all, unless we tell it skip past or create a more complex decision.
IF/ELSE/ENDIF allows us to make a decision that has two path ways for the program to execute. It executes between the
IF / ELSE statements when the comparison is
TRUE, otherwise it'll execute the code between the
ELSE/ENDIF
if S=0
S=1
print "S=1"
else
S=0
print "S=0"
endif
Sync
Wait Key
If all you want to do is flip the value of S, you can use subtraction to do that for you.
S = 1 - S
Now we're assuming S is either 0 or 1. When it's zero, S = 1-0, when it's 1 , S = 1-1.. So it'll toggle the value between Zero / One.