ANY-maze Help > The ANY-maze reference > The Protocol page > The elements of a protocol > Testing > Procedures > Elements of a procedure > Logical operators

Logical operators

Introduction

Logical operators allow the procedure to check for multiple events or conditions occurring. A logical operator takes two 'parameters' (i.e. things whose True/False values are checked), and returns True or False depending on whether any or all of the parameters themselves evaluate to True or False.

Logical operators can be one of the following:

  
Operator     Description
AND      True if BOTH its parameters are true.
OR       True if EITHER of its parameters are true.

Example

The following example will wait for one of two different events to happen. If either of these events occurs, the procedure will continue and use the If statement to determine which event it was.

  

  

Figure 1. This procedure will wait for either the animal to enter the zone, OR the specified time to elapse. If EITHER of these occur, the procedure will move on.

More information

Logical operators can be 'nested', to allow more than two conditions to be tested at a time. This means that you can use a logical operator as one of the parameters of another logical operator.

Any number of logical operators (or other True/False expressions) can be nested in this way.

  

  

Figure 2. This example shows an OR operator nested inside an AND operator.

If you realise that you've used AND instead of OR, or vice versa, you can quickly and easily change the operator in the procedure editor by right clicking on the operator and selecting Change operator from the resulting drop-down menu. This will change the operator without affecting either of its parameters.

See also:

 Elements of a procedure 

© Copyright 2003-2026 Stoelting Co. All rights reserved

ANY-maze help topic T0494