Save
...
computer science
programming
data types
Save
Share
Learn
Content
Leaderboard
Learn
Created by
lucy dock
Visit profile
Cards (13)
Data type
The kind of
data
a
variable
contains, it can be
character
,
string
,
integer
,
real
or
boolean
Character
The
data type
of a
single character
e.g. "A" or "$"
String
This data type stores a
series
of
characters
, e.g. "Zak", "MK44 5AB" or "123456789"
Integer
The
data type
of a
whole number
e.g. 5, 999 or -4
Boolean
This data type has only
two
values,
TRUE
and
FALSE
Real
A data type also called
floating point numbers
, they have a
decimal
part, for example 1.5, 0.935 or the value of Pi
Casting
Changing
the
data type
using a
function
such as STRING_TO_INT() or REAL_TO_STRING
STRING_TO_INT('12')
This AQA standard pseudo-code expression uses a
casting
function to change a
string
to an
integer
and results in the
integer
value
12
REAL_TO_STRING(12.8)
This AQA standard pseudo-code expression uses a
casting
function to change a
real
to a
string
and results in the
string
value "
12.8
"
STRING_TO_REAL('12.8')
This AQA standard pseudo-code expression uses a
casting
function to change a
string
to a
real
and results in the
real
value
12.8
Comparison
This type of operation always
returns
a
boolean
value, because it answers a question such as age > 18 or answer == "Yes"
Arithmetic
This type of operation returns either
integer
or
real
values because it performs a
numeric
calculation
such as fare * 2.5 or sum(temps)
Logic
This type of operation always
returns
a boolean value (
True
or
False
) because it performs
boolean
operations on other boolean
expressions