|
ANY-maze Help > The ANY-maze reference > The Protocol page > The elements of a protocol > Testing > Procedures > Writing a procedure using the procedure editor > Errors and warnings while writing a procedure > Error: Both sides of an 'AND' operator cannot contain events Error: Both sides of an 'AND' operator cannot contain events
DescriptionAs a test is performed, ANY-maze tracks the animal and also monitors the I/O ports set up in the protocol. Whenever anything changes (for example the animal's position, or the state of an I/O port), this is stored in the test's results and, internally, ANY-maze generates a 'test event'. These 'test events' are loosely (but not exactly) what you'll see on the Test data report. It's important to realise that these events occur one at a time; each one is passed in turn to a procedure to deal with. If a procedure is currently waiting for that event to happen, using a Wait until statement, then it will use this opportunity to move forward in the procedure and run subsequent statements (until the procedure ends or it reaches another Wait until statement). Otherwise, the procedure will go no further and will let other procedures process that same 'test event'. Because these events are processed one after the other, it's only possible for a procedure to receive one event at a time. It therefore follows that it can only wait for one event at a time. The procedure can wait for more than one event, as long as it is waiting for one of those events to happen, and not all of them to happen. For this reason, you can't have events on both sides of an AND logical operator. If a procedure attempts to use two events within the AND logical operator, this error will be displayed in the list of errors and warnings at the bottom of the procedure editor when the procedure is checked for errors or you exit the procedure editor. ExamplesThe following procedure will generate this error, because it is waiting for two events to happen at the same time.
Figure 1. This procedure will cause this error, because it uses events on both sides of the AND operator.
If you want your procedure to wait until the point that the animal has entered two different zones, you can often use built-in variables to get the information you require. The following example shows how the procedure in figure 1 can be re-written to achieve this:
Figure 2. This procedure uses a built-in variable to check whether the animal has previously entered the NE zone, and the event for entry to the NW zone, to wait for the animal to have entered both zones.
Note that it's perfectly OK to use events on either side of the OR logical operator, as in figure 3, because you're waiting for one of the events to happen, and not both.
Figure 3. It's OK to use events on either side of the OR logical operator.
See also:
© Copyright 2003-2026 Stoelting Co. All rights reserved ANY-maze help topic T0502 |