reading-notes
Coding Course Notes
Project maintained by liam02walker
Hosted on GitHub Pages — Theme by mattgraham
Lesson #8
Loops
- There are 2 loops, for loops and while loops
Initialize
- Setting an initial value to a variable that is right of the operator “=”
Declaration
- Declares the creation of the variable
Increment
- ++ means add 1 to something
Decrement
- – Means take 1 away from something
Iteration
- This is the repetition of a process in order to generate a sequence of outcomes
- Each repetition is one iteration, the outcome of each iteration is the start of the next one, 6+1 = 7, now the next iteration will start with 7
For Loop
- for (set initial value; a condition it needs to meet; update the value after each variable) {CODE IN HERE}
While Loop
- While loop runs whilst a condition is met. while true do x this will run infinitely
- do loop runs once and THEN checks if the condition is met