'if' statement:
Words and numbers in the tutstack are compared to each other and to constants
both as numbers and as strings by 'if' statements which are written
on edit lines having a '-' in the control column.
In string comparisons, the relational symbol must be given in inverted
commas.
The general form is
- if <condition> then goto <label>
or
- if <condition> then load <another_sucro>
where <condition> is a relation between tutstack words and constants.
Also an augmented form with an 'else' clause is available.
Examples:
- if W1 '=' Tue then goto Tuesday
If W1 contains string "Tue", sucro will continue from label 'Tuesday'.
- if W2 < W3 then load EX1 else goto End
If number in W2 is less than number in W3, call another sucro EX1
else go to label 'End'.
- if Wstr '=' {} then goto A
- if Wstr '<>' {sp} then goto B
If Wstr is empty, goto 'A'. If Wstr is not a space character,
goto 'B'.
Permitted relational symbols are =, <, <=, >, >=, and <> .
In SURVO MM, numerical conditions in if statements of sucros can be
more general:
Example:
/ def Wheight=W1 Wlength=W2
...
- if Wheight > 2*Wlength then goto A
- if Wheight*Wlength = 4000 then goto B
- if 100/Wlength > 0.7 then goto C else goto D
...
Thus on both sides of the condition, sums, differences, products,
and ratios of two operands may appear.
S = More information on conditional statements
C = Code words and statements in sucros