|
ANY-maze Help > The ANY-maze reference > The Protocol page > The elements of a protocol > Testing > Procedures > Running procedures > Errors and warnings while running a procedure > Warning: The number of items in the list passed to 'Initialise array' did not match the number of indexes in the array Warning: The number of items in the list passed to 'Initialise array' did not match the number of indexes in the array
DescriptionA procedure can use the Initialise array function to set up an array variable using a single statement, rather than having to use a loop to set each index separately. The values are entered as a comma-separated list of values, and the number of values must be equal to the number of values in the array. If it isn't, this error will be generated. ExampleThis example shows how an array of 5 values is initialised by passing 5 comma-separated values to the Initialise array statement. If the number of comma-separated values in the list were not equal to 5, this warning would be generated.
Figure 1. Using the Initialise array statement to set up the values of an array variable.
More informationIf this warning is generated, the procedure will initialise what values it can, and continue running. If not enough values are specified, these array indexes will be left as they are; any extra values will be ignored. For example, if the initialisation in figure 1 above used '1000, 2000, 3000' then the array would be initialised to contain the values 1000, 2000, 3000 as its first three values, and the last two would be left with their previous values. (If this is the first time the array is used, then the last two values would be 0). If you use '1000, 2000, 3000, 4000, 5000, 6000' then the last value would be ignored, and the array values would be initialised to 1000, 2000, 3000, 4000 and 5000.
See also:
© Copyright 2003-2026 Stoelting Co. All rights reserved ANY-maze help topic T0555 |