The ARRAYS blocks allow you to create and use arrays in your programs.

array initialize

The array initialize block allows you to create an array variable and define the number of elements in your array.

  1. Type in a name for your array variable (see About Naming Things for the rules.)  The default name is "list."  All other blocks using your new array must have the name typed in the same.
  2. Type in the number of elements your array will contain.

Now, your array will be accessible from any other array block that has the same name, such as the array get element block below.

array fill

The array fill block allows you to set multiple elements in your array using a comma-separated list of numbers.  All numbers must be integers.  Any decimal values will be truncated, and if there are more values typed in than there are elements in the array, it will only fill the available elements.  The elements are always filled in order starting with element 0 (zero).

array get element

The array get element block provides the value of the specified element.  You can specify the element to retrieve with either a number value block or any other block that provides a value, such as a get variable block.

array set element

The array set element block sets the element specified by the first inserted block to the value specified by the second inserted block so that the two are equal.

array clear

The array clear block sets all of the elements in your array to 0 (zero).