Course Content
Software Models
Software Models
0/1
Flowgorithm In-built Functions
Flowgorithm In-built Functions
0/1
Flowgorithm Call Symbol
Flowgorithm Call Symbol
0/1
Flowgorithm User-Defined Functions
Flowgorithm User-Defined Functions
0/3
Flowgorithm Recursion
Flowgorithm Recursion
0/1
Flowgorithm Turtle Graphics
Flowgorithm Turtle Graphics
0/2
Popular Programming Languages
Popular Programming Languages
0/1
Flowgorithm Expert
About Lesson

Initialize Array Elements

Now that we have defined the array, we can start using it. The initial part is to store the elements in the array so that we can process them afterward.

Using the Assign statement, we can store an element with the array variable name and subscript.

In the Flowgorithm, the subscript number starts from 0. For an array of size n, the valid values of the subscript are from 0 to n-1. The array subscript cannot be outside this valid range. For example, if the array size is 10, we can use the valid range of the subscript from 0 to (10-1), i.e., 0 to 9.

A good subscript is a value that is within the valid range. For example, a good subscript for the above example is 0 to 9, both inclusive. A bad subscript is a value that falls outside this valid range.

The subscript is enclosed with square brackets. For example, we can use the index as 0 to store the first element.

arr[0] = 5

Store Element in Array Flowgorithm

 

Example

Populate Array Flowgorithm Flowchart