Flowgorithm Data Types
Overview
In this tutorial, we will learn about Flowgorithm Data Types. When we create or declare a variable in a Flowgorithm flowchart, we need to specify the variable’s data type. The data types that can be used in a Flowgorithm flowchart are as follows:
- Integer
- Real
- String
- Boolean
- Array
Integer
The Integer data type is the most commonly used type. An integer variable is used to represent whole numbers. Whole numbers are numbers without fractions and are either positive or negative.
An integer variable can store numbers such as 7, 40, 2018, etc.
An integer variable cannot store numbers with fractions such as 40.5, 3.14, etc.
Example:
The number of students in a classroom is an integer datatype. The number represents a positive whole number or an empty classroom. We are pretty sure that we cannot have 40 and a half students in a class.
numberOfStudents = 40
The Variable Watch Window displays the integers in blue color.
Real
The Real data type represents numbers that can also have fractions. This data type can store both whole numbers and fractions. These numbers can be either positive or negative.
They have the whole and fractional parts separated with a decimal. In programming languages like Java, this data type is float or double data type. (“double precision floating point”)
Example:
To represent the height of the table we use the Real data type. It is not necessary for the height to be always in whole numbers. To represent a table height of 34.5 inches.
heightOfTable = 34.5
The Variable Watch Window displays the Real data type variables in purple color.
String
The String data type is used to store text. This includes words, letters, digits, etc. A pair of double quotes should surround the text. The Variable Watch Window displays the String data type variables in red color.
Examples:
Examples include words, letters, digits, or anything else we might send with a text message.
For example: “Hello, World!”, “C++ Programming for Beginners”, “Albert Einstein”, etc are
all strings.
The name of course is a String data type with letters and digits.
courseName = “CS100”
Boolean
The Boolean data type can only store either “True” or “False” values. Boolean variables allow us to make decisions in the flowcharts. The Variable Watch Window displays the Boolean data type variables in gray-green color.
Example:
A real-world example of a Boolean data type that can hold only two values is a fan switch. The switch can be in only two states either ON or OFF. The truth value of the Boolean expressions can either be true or false.
isSwitchOn = true
The Boolean data type is also called as Logical data type. The Boolean data type and the Boolean expression are the basis of decision-making in a flowchart. In the above example, the height of the table is 34.5 inches. The truth values for the expression can be much like Yes or No values:
Is the table height greater than 20 inches? -> Yes/ True
Is the table height greater than 40 inches? -> No/False
That’s it. We have successfully learned different Flowgorithm data types in this tutorial. We will discuss Arrays in a separate tutorial.
Arrays
Arrays can hold many values of the same data type:
Arrays In Flowgorithm Flowchart
—
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/