Flowgorithm For Loop [ 2024 ]
Flowgorithm For Loop
In this tutorial, we will learn Flowgorithm For loop statement. Loop structure in a flowchart executes a set of statements or instructions multiple times based on some conditions.
For Loop
A 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 is used for the For loop iterations.
- Start value: The initial value of the For loop variable.
- End value: This is the end value of the For loop variable. The loop terminates when the loop variable reaches this value.
- Direction: Increasing / Decreasing
- Step By: Loop variable Step value. The value of the loop variable will be increased/decreased for the next iteration.
Example
Let’s take a simple example of printing numbers from 1 to 20 to the console window. Imagine that without a 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 to view its output.
That’s it.
—
Flowgorithm Tutorials
Flowgorithm tutorials on this website:
- https://www.testingdocs.com/flowgorithm-flowchart-tutorial/
- Official website: http://flowgorithm.org/