Site icon TestingDocs.com

Create Variables in Flowgorithm Flowchart

Overview

To use the variables in a flowchart we need to create them. Variables are named memory locations to hold or store data in the program. The flowchart identifies each variable with a name called an Identifier.

Creating variables in a Flowgorithm flowchart is a two-step process.

Declare Variable

We use the Declare shape to declare a variable. Give a name for the variable and specify the data type. To add the declare shape to the flowchart, click on the flow control arrow line between the Main and End symbols.

Select the Declare symbol from the symbols pop-up window. Click on the Declare shape to add it.

 

 

Double click on the Declare shape to open the Declare properties Window. We can give the variable name and set the data type from the Type drop-down. Please note that Identifiers must start with a letter and avoid naming variables with reserved words.

 

Assign value

To assign a value to a variable, double-click on the line and choose the Assign shape. Double-click on the Assign shape to bring up the Assignment Properties window. Enter the variable name and the appropriate value and click on the OK button.

 

Example

Sample Declare and Assign shapes in a flowchart. A foo variable is declared as an Integer data type. The foo variable is assigned 25 as the value.

When we assign a value to the variable for the first time it’s called the variable initialization. In this example, we have initialized the variable foo to 25.

Constant vs Variable

In the above example, the foo variable can be re-assigned to another value in the program flow. A variable can change its value during the flowchart or program run. On the other hand, Constant doesn’t change its value during the program run. The value of the constant will be the same throughout the flowchart/program.

Example:

pi = 3.1415 (approx)

pi value is a constant in the program. The value of pi is predefined by the Flowgorithm. We can use constants in the flowchart. Once assigned the value of the constant would not change during the program run. It’s a good programming practice to denote user-defined constants in the flowcharts in uppercase.

Flowgorithm Tutorials

Flowgorithm flowchart tutorials on this website:

https://www.testingdocs.com/flowgorithm-flowchart-tutorial/

Flowgorithm Website

For more information on the Flowgorithm tool, please visit the official website at:

http://flowgorithm.org/

Exit mobile version