IF
Evaluates a conditional expression with a boolean result
Implemented by: dartmouth1, dartmouth4, ansimin, ansifull, decbasic, Altair, a2int, Applesoft, ti994ext, CBM, Atari, msatari, trs80, level2, trscolor, colormc, Sinclair, Atom, BBC, GWBASIC, MSX, bwbasic, bw32, ABasiC, QBasic, VBDOS, FreeBASIC, ugBASIC, minibasicmm, minibasicjs
With variations: hptsb, tasc (string-resulting expressions forbidden), TI994 (branches only), ataplus (multiline IF; with semicolon, no THEN after expression andENDIF), atxl (multiline IF; with semicolon, no THEN after expression andENDIF), Gambas, EndBASIC (single-line or multiline)
Also written as:
Usage
The primary and original purpose of IF was checking a condition for performing a jump to other line if it resulted true. For that, the condition is followed by THEN and/or GOTO keywords and the line number or label.
Variations
A number of BASICs inspired by decbasic allowed IF to be used like a "second order" command, in constructions such as PRINT A IF A < 10
1).
Examples
10 PRINT "HELLO"