Flowgorithm For Loop Statement
Overview
In this tutorial, we will learn For loop statement in Flowgorithm flowchart. Loop structure in a flowchart executes a set of statements or instructions multiple times based on some conditions.
For Loop
For loop is a repetitive structure. A For loop is a definite loop. It is best suited when we know how many times we need to run the loop.
To add the For loop construct, right click the mouse on the control line and choose the For symbol.
To define the loop construct double click on the for symbol. This will launch the For Properties window. Fill this window with the For loop properties. These properties decide how the For loop will run.
Loop variable:
The variable name used for the For loop iterations.
Start value:
The initial value of the For loop variable.
End value:
The end value of the For loop variable. The For loop terminates when the loop variable reaches this value.
Direction:
Increasing / Decreasing
Step By:
Loop variable Step value. The value of the loop variable to be increased/decreased for the next iteration.
Example
Let’s take a simple example to print numbers from 1 to 20 to the console window. Imagine without For loop we have to use the Output statements 20 times in the flowchart to print the numbers.
Define a loop variable : counter.
Add a For loop.
Define the Loop structure as shown.
In the loop add an Output statement to print the value of the loop variable : counter.
Sample Output
Execute the flowchart.
—
Flowgorithm Tutorials
Flowgorithm tutorials on this website:
https://www.testingdocs.com/flowgorithm-flowchart-tutorial/
Flowgorithm Website
More information on Flowgorithm, visit the official website: