====== ugBASIC User Manual ====== ===== IF...THEN ✓ ===== ===== SYNTAX ===== * ''IF [ expression ] THEN : ... : { ELSE : ... : } ENDIF'' ==== PURPOSE ==== Implement a conditional jump. This implementation assumes that an expression passed as a parameter is 0 (for false) and not zero (for true). In this case, if the expression is zero, it jumps directly to the statement following the corresponding ''ENDIF'' (or ''ELSE'', if present). Otherwise, the following code will be executed (up to ''ENDIF'' or ''ELSE''). ==== EXAMPLE ==== IF ( x == 42 ) THEN : x = 0 : ELSE : x = 1 : ENDIF See also the following example files: * ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/control_returning_01.bas|control_returning_01.bas]]'' * ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/control_returning_02.bas|control_returning_02.bas]]'' * ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/control_popping_91.bas|control_popping_91.bas]]'' ==== AVAILABLE ON ==== * Commodore 64 * ZX Spectrum 48K ==== SEE ALSO ====