mk90.basic.statements

Statement IF

Jump to a source line when a numeric condition is nonzero.

Syntax

IF expression THEN line-number

Parameters

ParameterMeaning
expressionZero is false; any nonzero 16-bit value is true.
line-numberLiteral positive line number present in the source.

Behavior

THEN must be followed by a literal destination number, not an inline statement or computed expression. The compiler resolves the target in its second pass.

If false, execution continues with the next instruction. Statements after a colon on the same physical line remain independent and still execute on the false path. If true, the jump skips those following instructions.

Example

10 INPUT A
20 IF A<0 THEN 50
30 PRINT "NONNEGATIVE"
40 END
50 PRINT "NEGATIVE"
60 END

Limits and diagnostics

No ELSE, IF block, THEN statement list or short-circuit evaluation. Use explicit numbered destinations.

Status-code reference.

See also

GOTO · GOSUB · Language syntax