In this tutorial, we will learn Flowgorithm Pass by Value concept using an example. Flowgorithm functions allow flowcharts to reuse code and abstract complex logic into smaller modules. We can convey the information to the function using the function parameters. They are several methods to pass the parameters. The most common are as follows:
- Pass By Value
- Pass By Reference
Pass By Value
In this approach, we will invoke the Flowgorithm function by passing the values to the function. In this mode, we will give the values directly to the function and the values are copied to the stack location.
Pass by value method ensures that the function/procedure will not change the value of a variable passed to a parameter.
Let’s look at a simple example to understand the concept. Define a function called sum() with two parameters: a and b. The data types of the function parameters are Real. The function adds the parameters and stores the value in the variable result.
The Main function invokes the sum() function using the pass-by-value approach.
In the example, the Main() function invokes the sum() function with values: 3.2 and 5.6
The values are copied to the function parameters a and b respectively. The function parameters scope is limited and is local to the function sum().
The Breakpoint statement is used to temporarily pause the flowchart execution to show the values in the Call Stack.
Flowgorithm flowchart tutorials on this website:
For more information on the Flowgorithm tool, please visit the official website at: