This is down to changes that were made for new versions of ZPE.
If statements do one thing if the condition is satisified, or do another thing if it is not. They are the most basic form of conditional checking and flow control.
if($a < 10) //Do something elseif ($b > $a && $b < 15) //Do something else if something else //Do something else end if //Alternatively, as of version 22.214.171.124, if statements can be a single line, terminated with a semi-colon if ($m == 10) print("It does indeed");
Version 1.6.6 added an additional syntax for the if statement that uses the
then keyword, officially known as
if $a < 10 then //Do something if $a < 10 then print("It does indeed")
then statement is different from a standard
if statement in that it can only have a single action inside the statement and does not end
with either a brace or
if $a < 10 then print("Hello 1") print("Hello 2")
The "Hello 2" string is not in the if statement however, the "Hello 1" is.
Prior to version 1.7.11, the
then keyword was simply
syntactic sugar and did not construct a action line if statement.
Else statements can also be added to
if $a < 10 then print("Hello 1") else print("Hello 2")
It should noted that these
else statements must be a single
expression like the
Version 1.6.7 also added the new
else if to
compliment the original
elseif - either is valid:
if ($a < 10) //Do something elseif ($b > $a && $b < 15) //Do something else if something else if ($c > $a && $c < 15) //Do something else if something else //Do something else end if
S1s and S2s really enjoyed the lesson on cybercrime using the lesson on How to Rob A Bank on… https://t.co/MxjDYE2JFu
6 months ago
S2s doing really well in hardware test! Also really enjoying doing tests electronically rather than on paper.… https://t.co/ritdfcW6Mw
7 months ago
S1 and S2 pupils listing input and output devices and giving answers such as keyboard and mouse but there were also… https://t.co/dGxDkYqFxo
7 months ago