Data Types - Lakelands Computing

Title
Go to content
Data Types
There are a few standard data types in programming:

Character (char) - a single letter, number of symbol eg:  a, 1 , $

Strings - this is a string of characters - used for Text. It includes letters, puctuation and numbers but you can not do maths with the numbers as the computer sees them as text. eg "Fish3!" It is technically a compound data type.

Int or integer -  whole numbers, can be positive or negative eg 99

Float, also called Real - floating decimal point. Any number with a decimal part eg 4.25

Boolean (bool) can only take 2 values, usually TRUE or FALSE, but could be 1 and 0,  Yes /No

Each data type needs a different amount of memory to be stored so using the correct one makes your programs more efficient.

To switch a variable from one data type to another you Cast it. The GCSE Computer Science exam sometimes has the question "What is casting?" in it so its worth remembering this.
All Text copyright Lakelands Academy & Mr T Purslow 2020.
All images copyright free / creative commons unless otherwise stated.
You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
All Text copyright Lakelands Academy & Mr T Purslow 2020.  All images copyright free / creative commons unless otherwise stated. You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
All Text copyright Lakelands Academy & Mr T Purslow 2020.  All images copyright free / creative commons unless otherwise stated. You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
Back to content