(As a clarification an expression is anything that evaluates to a number -> meaning it can also be a constant.)
TYPE = INTEGER, CHAR, REAL, STRING, BOOLEAN
STRING = something written as "Text here"
CHAR = something written as 't'
Valid arithmetic operators: +
, -
, *
, /
, mod
, div
Valid Logic Operators: {B} AND {B}
, {B} OR {B}
, NOT {B}
-
OUTPUT {EXPRESSION(s) / STRING(s)}
**these should be comma-separated
-
{VARIABLE / ARRAY_INDEX} <- {EXPRESSION / STRING}
-
DECLARE {VARIABLE} : ARRAY [EXPRESSION : EXPRESSION] OF {TYPE}
-
INPUT {VARIABLE / ARRAY_INDEX}
-
IF {CONDITION (BOOLEAN)} THEN {STATEMENTS} ELSE {STATEMENTS} ENDIF
- Note that the
ELSE
statement is optional. IF
statements can also be nested.
- Note that the
-
CASE OF {VARIABLE / ARRAY_INDEX} {EXPRESSION} : {STATEMENT (singular)} {EXPRESSION} : {STATEMENT (singular)} ... OTHERWISE : {STATEMENT (singular)} ENDCASE
- Note that the
OTHERWISE
clause is optional.
- Note that the
-
FOR {VARIABLE / ARRAY_INDEX} <- {EXPRESSION} TO {EXPRESSION} {STATEMENTS} NEXT
-
FOR {VARIABLE / ARRAY_INDEX} <- {EXPRESSION} TO {EXPRESSION} STEP {EXPRESSION} {STATEMENTS} NEXT
-
REPEAT {STATEMENTS} UNTIL {CONDITION (BOOLEAN)}
-
WHILE {CONDITION (BOOLEAN)} DO {STATEMENTS} ENDWHILE
A condition can be constructed using the comparison and boolean operators AND
, OR
, NOT
, >
, <
,<=
,>=
,==
, variables and expressions. Use brackets to make more explicit.