Page 32 - Touchcode_C6_Flipbook
P. 32
Data Type Description Declaration Example
Boolean It represents logical values. x= False TRUE, FALSE
(bool) Only boolean type values can be stored,
i.e., 'true (1)' or 'false (0)'.
It is a subtype of integer data type.
Critical Thinking
Example 1: Write a pseudocode to declare the different types of
variables, assign them an appropriate value and then get the values
as an output.
Solution:
Program Start
Function Main
Declare
Declare Integer a
Declare Float b
Declare Char d
Declare String e
Declare Boolean f
Assign
Assign a = 1567
Assign b = 1.567
Assign d = 'y'
Assign e = 'Hello world'
Assign f = FALSE
Output:
Output 'Integer a = ', a
Output 'Float b = ', b
Output 'Char d = ', d
Output 'String e = ', e
Output 'Boolean f = ', f
END FUNCTION
PROGRAM END
Note: In Python, there is no command to declare variables. In this variable is created when
you assign a value to it and the data type of the variable can be assigned by using typecasting.
30 Touchcode-VI

