Mindmap
2.2 Programming
Inhalt der Mindmap
2.2 Programming
Variables
- Should not start with a number or contain spaces
- Is a specific data type
Key words
- Whole number
- no decimals/fractions
- Real number
- has a fractional part
- Boolean
- Trueorfalse
- String
- any text that isn't meant to be calculated
- Whole number
Operators
- Operators represent the operations that are performed on the data.
- operators in Maths, e.g. +, -, /, *, ^, etc.
- Numbers: addition, subtraction, division, modular division (division with a remainder), integer division, multiplication, to-the-power-of, negation
- Boolean: AND, OR, NOT, larger, smaller, equal, not equal
- Strings/characters: slicing, length, format
- Addition total = amount + VAT Subtraction e.g. age = cur_year – y_birth Division divide = 5 / 2 Modular division myRemainder = 5 MOD 2 (find a remainder) Integer division intDivision = 5 DVI 2 Multiplication totalCost = cost * 0.2 Exponential area = 3.1 * radius^2
Sequencing
- Sequencing allows a programmer to solve complex tasks through a number of simple steps.
- BENEFITS
- Each line follows the next Create simple programs very quickly Easy to follow for a small program Fundamental principal of a program - Starts at the top, finishes at the bottom
- NEGATIVES
- Not at all efficient Becomes very difficult to follow with large programs Extremely hard to maintain
SELECTION
- Selection changes the flow of a program, depending on a set of conditions, it is used for validation, calculation and making sense of a user’s choices.
- The use of selection allows a computer to “think” – make decisions
- Apart from efficiency in reducing the number of lines of code we would run, we need programs to make decisions based on a set of criteria or condition. If the condition is true, we run this set of lines of code, if the condition is false – we run some other set of lines.
- Selection changes the flow of a program, depending on a set of conditions, it is used for validation, calculation and making sense of a user’s choices.
ITERATION
- The two common types of iteration: WHILE (condition-controlled) and FOR COUNTER (counter-controlled)
- loops are called “iteration” because they run through or “iterate” through multiple similar items of data.
- FOR COUNTER
- This is the loop for when we know in advance how many times we want to loop back to the start, so we keep count and check against the number of repetitions (iterations) that are required, using a counter.
- we use counters as virtual beads to know when to stop.
- This is the loop for when we know in advance how many times we want to loop back to the start, so we keep count and check against the number of repetitions (iterations) that are required, using a counter.
- WHILE
- Sometimes, we don’t know in advance how many times we want to repeat something, so we use “conditional” or “condition-controlled” loops. These loops evaluate a Boolean condition every time they run (either in the beginning or the end of an iteration) and if it is true – they carry on, otherwise, the loop stops.
- These loops are better for user interfaces, or in general to allow interaction of the program with the outside world.
- Sometimes, we don’t know in advance how many times we want to repeat something, so we use “conditional” or “condition-controlled” loops. These loops evaluate a Boolean condition every time they run (either in the beginning or the end of an iteration) and if it is true – they carry on, otherwise, the loop stops.
- The two common types of iteration: WHILE (condition-controlled) and FOR COUNTER (counter-controlled)
Informationen
- Beschreibung
- Mindmap am 2.2 Programming, erstellt von Khang Duong am 18/01/2019.
- Erstellt von
- Khang Duong
- Aufrufe
- 1
- Bewertung