Variables, Constants and Data Types
Data types and their usageEdit
Data Type | Description | Usage | Example |
---|---|---|---|
INTEGER |
A whole number | Uses the normal denary system |
123, -123, 0 |
REAL |
Any number that has fractional parts/decimals | Written with at least one digit either side of a decimal point |
12.4, 3.0, -17.34 |
CHAR |
A single character | A single character enclosed between single quotation marks |
'a', '@', '5' |
STRING |
A series of zero or more characters | No, or a series of characters enclosed between double quotation marks |
"banana", "Q173hf", "John Doe" |
BOOLEAN |
A logical Expression | True or False |
TRUE, FALSE |
DATE |
Any valid date | Use the format:
dd/mm/yyyy If a different format must be used, use a comment to explain your decision. |
21/10/2015, 03/07/1985, 12/11/1955 |
Variable DeclarationsEdit
Python has no variable declarations.
Language | General Usage | Example Usage |
---|---|---|
Pseudocode |
DECLARE <Identifier> : <Data Type>
|
DECLARE Weight : INTEGER
DECLARE Mass : REAL
DECLARE Material : STRING
|
VB.NET |
Dim <Identifier> As <Data Type>
|
Dim Weight As Integer
Dim Mass As Double
Dim Material As String
|
ConstantsEdit
Python has no constants.
Language | General Usage | Example Usage |
---|---|---|
Pseudocode |
CONSTANT <Identifier> = <Value>
|
CONSTANT Pi = 3.14
CONSTANT e = "2.718"
CONSTANT Multiplier = 10
|
VB.NET |
Const <Identifier> As <Data Type> = <Value>
|
Const Pi As Double = 3.14
Const e As String = "2.17"
Const Multiplier as Integer = 10
|
AssignmentsEdit
Language | General Usage | Example Usage |
---|---|---|
Pseudocode |
<Identifier> ← <Value>
|
Name ← "Stephen"
Age ← 47
Weight ← 19.32
|
VB.NET |
<Identifier> = <Value>
|
Name = "Stephen"
Age = 47
Weight = 19.32
|
Python | <Identifier> = <Value>
|
Name = "Stephen"
Age = 47
Weight = 19.32
|