if ( fl -- )
published: 28 January 2023 / updated 28 January 2023
Lire cette page en français
The word IF
is of immediate execution.
IF
marks the beginning of a control structure of type IF..THEN
or IF..ELSE..THEN
.
At runtime, the definition part between IF
and THEN
or between IF
and ELSE
is executed if the boolean flag at the top of the data stack is true (f<>0).
Otherwise, if the boolean flag is false (f=0), the definition part located between ELSE
and THEN
will be executed. If there is no ELSE
, execution continues after THEN
.
Example:
: Nice? ( fl ---)
if
." Nice weather "
else
." Cloudy weather "
then
;
1 Nice? \ display: Nice weather
0 Nice? \ display: Cloudy weather
The word IF
is of immediate execution.
IF
marks the beginning of a control structure of type IF..THEN
or IF..ELSE..THEN
.
At runtime, the definition part between IF
and THEN
or between IF
and ELSE
is executed if the boolean flag at the top of the data stack is true (f<>0).
Otherwise, if the boolean flag is false (f=0), the definition part located between ELSE
and THEN
will be executed. If there is no ELSE
, execution continues after THEN
.
WARNING
In our articles, reference is made to different versions of the language
FORTH (AmForth, FlashForth, GForth ...).
All of these versions are licensed GNU .
Ref: Licence publique générale GNU
So you can download, install, use all these versions on your computer
and / or on an ARDUINO card with no transfer of fees and no special conditions.
The GNU/GPL license does not give you the right to monetize the source and executable codes
marked under this license.
You are authorized to monetize your own achievements, articles, books if these products are the
fruit of your labors.
The GNU / GPL license exploits the principle of sharing and collaboration. If you profit
know-how in files marked GNU, reciprocity is expected from you by sharing
your achievements, even modest.