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

Other functions

Introduction

As well as mathematical functions, there are some additional useful functions available to you when writing procedures:

 'Is undefined' function 
 Join function 
 Size of array function 
 Sum array values function 
 Array as text function  

The Is undefined function

 There are a number of functions and operators within the ANY-maze procedure system which return a numeric value. If any parameters to these are not valid, then the function or operator will return #N/A. 

The Is undefined function can be used to check whether a variable's value is undefined (i.e. set to this '#N/A' value).

The Join function

The Join function can be used to join two or more pieces of text together.

You can insert pretty much anything into the parameters of this function text - either a user-defined variable, a built-in variable indicating some information about the test, or the name of an ANY-maze protocol item such as a pellet dispenser (for example, to send an SMS message about the pellet dispenser being out of pellets).

The Join function will accept two or more text parameters; it will start with two parameters, but you can click on the drop-down arrow next to any parameter to insert a new parameter to the left or right of it. This drop-down can also be used to delete any parameter, or you can simply drag the parameter out of the Join function to remove it.

The Size of array function

The Size of array function can be used to return the number of slots, or indexes, in an Array variable.

The Sum array values function

The Sum array values function can be used to return the sum of all numerical values in an Array variable. If there are any non-numeric values in the array, this function will return #N/A.

Note that True/False values are evaluated as 1 and 0, respectively, so you can easily see if there are any True values in an array of True/False values simply by checking for a non-zero return from this function.

The Array to text function

The Array to text function can be used to obtain a representation of the contents of an array as a text string. This can be useful to allow the contents of the array to be written to the Debug output window.

As an example, if an array variable has four items in it, and contains the values True, False, False and True, then this function will return the text "True, False, False, True".

Note that if any of the indexes of the variable have not yet been written to, these will be displayed as '0'.

Example

The following example uses the Is undefined function to check a variable's value, and then the Join function to create text to output on the display.

  

  

Figure 1. Example using the Is undefined and Join functions.

© Copyright 2003-2026 Stoelting Co. All rights reserved

ANY-maze help topic T0498