Logical expressions are statements combining variables, values, and operators (like AND, OR, NOT, <, >, =) that evaluate to a boolean of true or false.

    Below are examples of simple and complex logic expressions.

  1. Simple Expressions

    You can embed Logical Expressions inside if, if:else, and while actions. When being used in these task actions, they don't need to be surrounded by {{}}.

    The following gives you some examples of what can be done using Logical Expressions.

    1 == din[1].state (This checks if input 1 on the JNIOR is on)

    100 <= temp[1].fahrenheit (This checks if the temperature from a temperature probe connected to the JNIOR is recording farhenheit above or equal to 100 degrees.)

    You can use Signal Names that reference signals you created in place of some expressions also.

    1 == fire_alarm (fire_alarm represents a name for a signal that uses input 1 in the signals tab.)

    100 <= outside_temp_f (outside_temp_f represents a name for a signal that uses a temperature probe in the signals tab.)

  2. Complex Expressions

    More complex expressions can be implemented using operators such as && (AND), || (OR) and parenthesis.

    Using the && operator inbetween two expressions makes it so that both expressions must both be true for the entire statment to return true, or else it returns false. The following statment will only evaluate as true, if both output 2 AND output 3 on the JNIOR are on.

    rout[2].state && rout[3].state

    Using the || operator inbetween two expressions makes it so that at least one of the expressions must be true for the entire statment to return true, or else it returns false. The following statment will only evaluate as true, if either output 2 OR output 3 on the JNIOR are on.

    rout[2].state || rout[3].state

    The following statment showcases using both expressions being used together. It will only return true either output 4 is on, OR if output 2 AND output 3 are on

    (rout[2].state && rout[3].state) || rout[4].state