When we create or declare a variable in a Flowgorithm flowchart, we need to specify the data type of the variable. The data types that can be used in a Flowgorithm flowchart are as follows:
The Integer data type is the commonly used type. An integer variable is used to represent whole numbers. Whole numbers are numbers without fractions and are either positive or negative.
Number of students in a class is an integer datatype. We are sure that we cannot have 40 and a half students in a class.
NumberOfStudents = 40
The Real data type is used to represent numbers that can have fractions. These numbers can be either positive or negative. They have both the whole part and the fractional part separated with a decimal. In programming languages like Java, this data type is float or double data type “double precision floating point”.
To represent height of the table we use 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 String data type is used to store text. This includes words, letters, digits, etc. The text should be surrounded by a pair of double-quotes.
The name of course is a String data type with letters and digits.
Name = “CS100”
The Boolean data type can only two values. It can store either “true” or “false” values. Boolean variables allow us to make decisions in the flowcharts.
A real world example of 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 be either true or false. In above example the height of the table is 34.5 inches. The truth values for the expression can be much like Yes or NO:
Is the table height greater than 20 inches ? -> true
Is the table height greater than 40 inches ? -> false
We will discuss Arrays in a separate tutorial.