An array is a data structure that stores elements of the same datatype. Individual array elements in an array can be accessed by the index. All objects that are stored in the array must be of the same data type. For Example, if the array is a number array then all the objects in the array must be numbers. An object in the array is associated with an integer index which can be used to locate the object. The first object of the array has index 1. Unlike in most programming languages like Java where the array index starts with 0, in the Raptor flowchart, the index of an array starts at 1.
An array of size 5 that holds fruits.
Let’s use a single dimensional array to calculate the sum of rainfalls in a city using the Raptor flowchart. We use rainfall as an array variable to hold the rainfalls of the city.
Individual array elements in the array can be accessed using rainfall[index]
index is an integer and starts with 1
We can also store variables in the array using the index. For example, to store 12 cm of rainfall for the 3 month, we can use
rainfall <- 12
Output of the flowchart
Reading values into an array
Raptor Tutorials on this website can be found at:
RAPTOR official website: https://raptor.martincarlisle.com/