Data Types and Operations

The basic data types which can be used in a high-level programming language  are as follows:

Data Type Description Examples
Integer Whole numbers, positive and negative 23, -45, 0
Real All numbers including fractions 15.7, -19.25, 8
Character Anything you see on the keyboard and some more besides... 'A', 'z', '8','?'
String A number of characters... 'Hello World'
'Gerty Snoot'
Boolean True or false TRUE or FALSE

Operations on these data types

Data Type Basic Operations
Integer, Real All arithmetic functions +, -, *, / etc..

Relational operations

  • < less than
  • > greater than
  • <> not equal to
  • >= greater than or equal to
  • <= less than or equal to

(all these in the normal arithmetic sense)

 

Character, Strings Use + for string concatenation - adding strings together.

eg 'Bull' + 'frog' = 'Bullfrog'

Use < , > etc in the alphabetical sense. These are all true...

  • 'Abacus' < 'Beetle'
  • 'Gannet' > 'Fish'
  • 'Barracuda' > 'Barnacle'
Boolean Usually used in conditional statements...'Flag' may be a Boolean variable....

if Flag = true then do...

if Flag then do ...