ANY-maze Help > The ANY-maze reference > The Protocol page > The elements of a protocol > Testing > Procedures > Elements of a procedure > Statements available to procedures > The Go to statement

The Go to statement

Introduction

The Go to statement is used in conjunction with a Label statement, to perform simple loops or jumps in a procedure.

A Go to statement can jump to a label anywhere in the procedure. If the label is before it in the procedure, then this will usually result in a simple loop in the procedure (i.e. repeating a sequence of statements multiple times). If the label is after it in the procedure, then more complex logic can be performed - for example, missing out a section of the procedure depending on certain conditions in the test.

Example

The following example shows a Go to statement being used to perform a simple loop, which executes continually throughout the test.

  

  

Figure 1. A procedure showing the use of the Go to statement to perform a simple loop.

This same logic could also have been implemented using a Repeat statement.

More information

A Go to statement can be used inside a container If statement or Repeat statement, to 'jump' out of that statement and continue the procedure running from a different point. Any statements within the container that occurred after the Go to statement will not be run.

  

  

Figure 2. A procedure showing the use of the Go to statement to jump out of a Repeat statement. If the animal has already entered the 'Centre' zone, then the stimulus will not be activated.

See also:

 Statements available to procedures 
 The Label statement  
 The Wait until statement   
 The Action statement 
 The Repeat statement   
 The If statement     
 The Set value statement    
 The Run sub-procedure statement  
 The Note statement   
 Other statements 

© Copyright 2003-2026 Stoelting Co. All rights reserved

ANY-maze help topic T0483