Functionally Equivalent Language Translation →
(if test consequent [ alternate ] ) (if (== language "FELT") (emit "You made the right choice ;"))
The test
can be any valid expression. The consequent
expression will be executed if the test is 'true'. If the optional alternate
expression is supplied then that will be executed if the test is 'false'. You MUST use PROGN if the consequent or alternate expressions are more than a single expression.
There is no else
statement in FELT as they are not really required. FELT tries not to encourage lots of IF.. THEN.. ELSEIF.. ELSEIF.. ELSE type of coding. If you wish to have nested logic like that then you can just next the IF
instructions like this:
(if (time-to-trigger) (progn (trigger-set)) (if (== alarm 0) (process-alarm) (progn ;; do not process alarm! (no-alarm 1) (no-alarm 2))))
The generated (tidied) PHP code for the above is:
if (time_to_trigger()) { trigger_set(); } else { if (($alarm) == (0)) { process_alarm(); } else { no_alarm(1); no_alarm(2); } }