Pascal

Pascalated BASIC

ZX Spectrum BASIC

Note

REPEAT
...
UNTIL condition;

REPEAT variable
...
UNTIL condition;

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

REPEAT
(variable must have only 1 char)
(be careful: the variable cannot be used by another cicle 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

WHILE
(BEGIN is not needed)

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 : REM IFBEGIN
FOR i = i TO 0.5 STEP 1 : REM IFBEGIN
...
NEXT i : REM ENDIF
LET i = (i<0)*1 + (i=0)*( condition2 ) : REM ELSEIF
FOR i=i TO 0.5 STEP 2 : REM ELSEIF
...
NEXT i : REM ENDIF
LET i = (i=0) : REM ELSE
FOR i = i TO 0.5 STEP 2 : REM ELSE
...
NEXT i : REM ENDIF

IF ... BEGIN ... END
(sometimes ':' is not enough)

routine_name(arg)

LET arg1 = arg
PROC RoutineName

LET arg1 = arg
GO SUB RoutineName

procedure call

PROCEDURE routine_name
BEGIN
...
END

DEFPROC RoutineName
...
ENDPROC

: REM RoutineName
...
RETURN

procedure declaration

t := routine(arg)

LET arg1 = arg
GO SUB RoutineName
LET t = result

LET arg1 = arg
GO SUB RoutineName
LET t = result

function call

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

DEFPROC RoutineName
LET v = arg1
...
LET result = v
ENDPROC

: REM RoutineName
LET v = arg1
...
LET result = v
RETURN

function declaration

total_apples := 0

LET TotalApples = 0

LET TotalApples = 0

java notation
(Remember that a string array and a simple string variable
cannot have the same name  unlike the case for numbers)

total_apples := 0

LET total apples = 0

LET total apples = 0

you can use spaces (they are ignored)
but the BASinC emulator removes the spaces
(only numeric variables can have more than 1 char)

Each Pascalated command must be on a separately line.
The command FORNEXT also must be at the beginning of the line.
FOR i=1 TO 10
PRINT i
NEXT i

If you want to make an exception, start de line with an ":"
: FOR i=1 TO 10 : PRINT i : NEXT i
