Pascal

Pascalated BASIC

ZX81 BASIC

Note

REPEAT
...
UNTIL condition;

REPEAT variable
...
UNTIL condition

FOR i = 0 TO 0.5 STEP 0
...
LET i = condition
NEXT i

Variable name must have only 1 char.
Be careful: the variable cannot be used by another loop at the same time.

WHILE condition DO
BEGIN
...
END

WHILE condition DO variable
...
ENDWHILE

FOR i = NOT( condition ) TO 0.5 STEP 0
...
LET i = NOT ( condition )
NEXT i

Variable name must have only 1 char.
Be careful: the variable cannot be used by another loop at the same time.

IF condition1 THEN
BEGIN
...
END
ELSE IF condition2 THEN
BEGIN
...
END
ELSE
BEGIN
...
END

IF condition1 BEGIN variable
...
ELSEIF condition2
...
ELSE
...
ENDIF

LET i = condition1
FOR i = i TO 0.5 STEP 1
...
NEXT i
LET i = (i<0)*1 + (i=0)*( condition2 )
FOR i=i TO 0.5 STEP 2
...
NEXT i
LET i = (i=0)
FOR i = i TO 0.5 STEP 2
...
NEXT i


routine_name(arg)

LET ARG = X
PROC ROUTINE NAME

LET arg1 = arg
GOSUB ROUTINE NAME

Procedure call

PROCEDURE routine_name
BEGIN
...
END

DEFPROC ROUTINE NAME
...
ENDPROC

REM ROUTINE NAME
...
RETURN

Procedure declaration

t := routine_name(arg)

LET ARG = X
PROC ROUTINE NAME
LET T = RESULT

LET ARG = X
GOSUB ROUTINE NAME
LET T = RESULT

Function call

FUNCTION routine_name (arg:REAL) :REAL;
BEGIN
...
END;

DEFPROC ROUTINE NAME
LET U = ARG
...
LET RESULT = V
ENDPROC

REM ROUTINE NAME
LET U = ARG
...
LET RESULT = V
RETURN

Function declaration

total_apples := 0

LET TOTALAPPLES = 0
LET TOTAL APPLES = 0

LET TOTALAPPLES = 0
LET TOTAL APPLES = 0

Remember that a string array and a simple string variable
cannot have the same name  unlike the case for numbers.
You can use spaces  they are ignored.
Warning: You cannot use spaces when the first word is a reserved word
or already exist one variable name with that word.
