Please enable JavaScript.
Coggle requires JavaScript to display documents.
Control Flow (Conditionals (If - Else (Is the basic form of a condition.…
Control Flow
Conditionals
If - Else
Is the basic form of a condition. If the first condition is not accomplished then the else condition will be executed.
Else - If
This happens when you have an if-else condition, if the condition is not accomplished then the else will be executed but inside the else there is another if condition to be analyzed.
Switch
It is a way of comparing if an expression matches with multiples cases. If none of the cases has a match with the expression then there is a default statement that happens.
Loops
While
The while loop is a cycle which repeats a set of orders until a break condition is reached. When the while is declared there must be a condition for that while to keep looping. if the condition is not met then the cycle breaks.
For
This type of cycle is different to while, it has a starting condition, a terminating condition, and an increment is usually used as the auxiliary instruction of the loop.
do-while
The do while loop works very similar to the while , the only difference is that the block of instructions is executed and then the condition is analyzed.
Statements and Blocks
Statements are instructions just like a t++ or print(....) that have a semicolon as statement terminator, this mean that they have ; at the end of the line.
Blocks are groups of statements that are surrounded by { and }. A block begins with { and finishes with }.
Break and Continue
-
Continue is used to start the cycle again from that point instead of getting to execute the whole block of instructions.