Mindmap
Programming Code Patterns
Inhalt der Mindmap
Programming Code Patterns
Counter Controlled Loops
- Loops which will run a predictable number of times
- e.g. while x < 5:
- Counter
- Tracks no. of times loop will run
- Loops which will run a predictable number of times
Conditional Loops
- A while loop that will continue while or until a condition is met
- Can be associated with validation
- while loops can be used for the following checks:
- presence check
- full number range check
- range check
- while loops can be used for the following checks:
- Can be associated with validation
- For loops
- For will determine the iteration's starting point
- range(x) will determine the number of iterations
- e.g. for x in range(5) will go from 0 to 4 because (0 1 2 3 4)
- will run forever if a condition that causes the while loop to run never changes
- A while loop that will continue while or until a condition is met
Iterating over a 1D array
- 1D array iteration requires only 1 index e.g array[x]
- Counter controlled loop
Iterating over a 2D array (doing something with every value)
- Updating values requires variable indexes
- Counter controlled loop
- Arrays cannot be infinitely large
- e.g. grid[row][col] = variable
Iterating over the columns of a 2D array
- The columns of an array are linked to the first index
- E.g. grid[1][0] would indicate the first column which is column 0
- counter controlled loop
- Incrementing variable
- The columns of an array are linked to the first index
Iterating over the rows of a 2D array
- The rows of an array are linked to the second index
- E.g. array[0][1] 0 would indicate row 0. 1 Indicates element 1 of row 0
- Counter controlled loop
- Incrementing variable
- The rows of an array are linked to the second index
Functions are very likely to contain some form of loop
- Functions can embed these loops within themselves and can be called when needed
Iteration is used all the time in programming code
Code patterns are types of code that are frequently repeated in programming
Informationen
- Beschreibung
- GCSE Computing Mindmap am Programming Code Patterns, erstellt von Gabriel Gozo am 27/10/2020.
- Erstellt von
- Gabriel Gozo · Okt 2020
- Aktualisiert
- 27 Okt 2020
- Aufrufe
- 1
- Bewertung