KRL uses the "event condition action" pattern. Since there is only space for a single Boolean expression in the condition, KRL adds a prelude section in which preparatory computations can be done. It fits in between the event and condition, setting things up for the conditional action. The prelude begins in line 3 in the rule template shown below.
rule test { select when sensor heartbeat pre { ... } if condition_is_true then { send_directive("Heartbeat") } fired { ... } else { ... } }
See the child pages of this page for details.