Please enable JavaScript to view this site.

A-Shell Reference

IF <condition> {THEN} <statements> {ELSE <statements>}

This is the original IF statement supported by the first version of A-BASIC. Multiple statements were possible in both the THEN and ELSE clauses, but all had to be combined into a single logical line using colons to separate the statements and ampersands to continue on to subsequent physical lines. Although inelegant, this form of the IF statement was often combined with the GOTO statement in early A-BASIC to create primitive loops. Now deprecated, this primitive form of the IF statement has been superseded by the more powerful and elegant IF...ENDIF construction.

Compatibility: Supported in all versions of the compiler. A-Shell implementation matches the AMOS implementation at both the source and RUN level.

Example

if TOTAL > CREDIT'LIMIT goto LIMIT'EXCEEDED

 

if CHROMO = XY then &

    SEX = “M” : ? “It's a boy” &

else SEX = “F” : ? “It's a girl”