In the earlier tutorial, we have learnt about Array in flowchart. However, we have hardcoded the array elements. In this tutorial, we will learn to populate array with user input. The contents in the array would be dynamic.
fruits is the array variable. The array holds fruit names i.e String data type. The array size is 5.
index is the Array index variable. The legal values of the array index variable in this example is from 0 to 4.
The flowchart uses two for loops. The first loop is to populate the array contents from the user and the second loop to output the contents of the array to the console window. A for loop is used because we know the array size beforehand and how many times to iterate the loop.
For loop in Flowgorithm
Execute the flowchart. Click on the Green run command to execute the flowchart.
The flowchart prompts user to enter 5 fruit names. The names are stored in the fruits array.
Bad Subscript Error
Sample error is we attempt to store or access array elements that is not within the valid range:
Flowgorithm Tutorials Link: