Mapa mental
Program Control Structures

Contenido del mapa
Program Control Structures
Selection
- The sequence of instructions can be changes based on the value of variables within that program. Statements are selected based on a value through the use of IF statements and boolean operators
- IF- Statement
- Whnen a condition in an IF-statement evaluates to true, the statements follwing it are executed, otherwise the statements following ELSE are executed.
- IF- Statement
- The sequence of instructions can be changes based on the value of variables within that program. Statements are selected based on a value through the use of IF statements and boolean operators
Iteration
- "Repetition"; when a section of code is carried out more than once.
- Unconditional repetition
- There is a start value and a stop value for the loop. The loop is incremented by 1 (default) each time.
- Example: a program to output all the multiples of three between 3 and 99 will repeat the loop 97 times.
- Conditional repetition
- The loop will run until a particular condition is true or false..
- Example: a program to ensure that a user enteres a integer value between 1 and 50. A boolean variable can be used to control the loop.
- Unconditional repetition
- Loops and conditions are used to repeat the sections of code.
- FOR Loop: for(initialise, condition, increment)
- for(int i = 0, i < totalTime, i++)
- initialise: variable is set to the starting value of the loop once only
- condition: this is evaluated during each execution of the loop
- increment: updates the loop control variable
- WHILE Loop: While (Boolean Condition) do
- A boolean condition has to be met (true or false) for the loop to execute, and will run until the boolean condition is the opposite - true or false
- A loop can also test the condition at the end of the loop. This means the code will be executed at least once.
- FOR Loop: for(initialise, condition, increment)
- "Repetition"; when a section of code is carried out more than once.
Sequence
- This denotes the order in which instructions are carried out. Each statement is carried out one after the other.
- Incorrect Example:
- This example is trying to output the average before the numbers have been entered and running this would result in a logic error.
- Correct Example:
- Incorrect Example:
- This denotes the order in which instructions are carried out. Each statement is carried out one after the other.
Imágenes y archivos del mapa
Información
- Descripción
- GCSE GCSE Unit 4 Mapa Mental sobre Program Control Structures, creado por a St George el 07/05/2022.
- Creado por
- a St George
- Visitas
- 1
- Valoración




