Skip to content

wait_if

Syntax

wait_if(<number>, <predicate>)

Parameters

number
An expression that evaluates to a number of simulation steps. The value is rounded to the nearest integer.
predicate
A numeric expression that evaluates to either true or false.

Description

Important

This is a special action which cannot appear within an if statement or loop!

This rule is similar to wait, but only waits for the specified number of steps if the predicate argument evaluates to true. If it evaluates to false, the number of steps specified by the default wait action will be followed instead.

Examples

    state StateA {
        wait_if(9999, false) # Should not execute
        wait(1) # Should execute
        default(StateB)
    }

    state StateB {
        wait_if(add(1, 0), true) # Should execute.
        wait(9999) # Should not execute
        default(StateC)
    }

See Also