if  ( fl -- )

published: 8 January 2022 / updated 16 February 2022

Lire cette page en français

 

vocabulary: forth

The word IF is executed immediately.

IF marks the start of a control structure for type IF..THEN or IF..ELSE..THEN.

Example:

: WEATHER? ( fl ---) 
    IF 
        ." Nice weather " 
    ELSE 
        ." Bad weather " 
    THEN ; 
1 WEATHER?    \ display: Nice weather 
0 WEATHER?    \ display: Bad weather 

Legal: site web personnel sans commerce / personal site without seling