iGCSE Computer Science - Distance Learning
Variables & Constants
When we first learn programming, it’s very easy to want to jump straight in and expect to be able to write exciting programs straight away. In fact, one of the best things that you can do is make sure that you understand the basics first, such as inputs, outputs, and variables.
The building blocks of programming are known as constructs. These form three main types of construct:
Sequence: the order in which the lines of code are run
Selection: code that only runs if a condition is met
Iteration: code that repeats without needing to be rewritten
There are five main data types that are used at GCSE, and as a part of your course (and later your exam) you will be expected to understand how they work and when it is most appropriate to use them. Creating practice programs on a regular basis is the best way to do this – although we are introducing data types this week, we will be referring back to each of these five types regularly throughout the course.
The definitions below will give you the basic knowledge needed to use these data types, but I strongly recommend that you complete the full Data Types section to give you more information and practical ways to apply your knowledge.
Char – a single character (symbol)
String – one or more characters, often forming a word or phrase
Integer – a whole number
Real – a decimal number (aka. a float)
Boolean – a special type that only holds either True or False
Once you have completed the practical elements shown in the video tutorial, complete the following assignment task. The practice version of the code is below – submit your final answer in your Tutor Marked Assessment.