What do IF statements allow a programmer to do?
To check if a condition is true or false, and carry out different actions depending on the outcome
What structure do IF statements normally have?
IF … THEN:
ElSE:
When is ELSE not needed in an IF statement?
If there is nothing for the program to do when the condition is false then leave out the ELSE part
What is a nested IF statement?
A more complex IF statement, made by putting one IF statement inside of another
What do nested IF statements allow you to do?
-check more conditions once you have established the previous condition is true
What are IF-ELSEIF statements used for?
To check multiple conditions
-only check more conditions if the previous condition is false
What are SWITCH-CASE statements?
statements that can check whether a variable has specific values
When are SWITCH-CASE statements used?
When you want a program to perform different actions for different values of the same variable
What is the structure of SWITCH-CASE statements?
SWITCH … :
CASE … :
CASE … :
ENDSWITCH
What is the drawback of SWITCH-CASE statements?
They can only check the value of one variable
IF-ELSEIF statements can check if multiple conditions are true
What are FOR loops?
An example of count-controlled loops
They will repeat the code inside of them for a fixed number of times
-the number of times they are repeated depends on an initial value, end value and step count (can also be set as the program runs by using a variable as the number)
What is the structure of FOR loops?
FOR i in RANGE():
NEXT i
What are the different types of loops you can have that are controlled by conditions?
REPEAT … UNTIL
WHILE
DO WHILE
What is an example of a count-controlled loop?
FOR loops
What are the features of REPEAT loops?
What are the features of WHILE loops?
What are the features of DO WHILE loops?
What is the structure of a REPEAT loop?
REPEAT
…
UNTIL condition
What is the structure of a WHILE loop?
WHILE condition
…
ENDWHILE
What is the structure of a DO WHILE loop?
DO
…
WHILE condition
Whant are the 3 different Boolean operators?
AND
OR
NOT
Why are Boolean operators used in conditions?
Boolean operators can be used to make all the different selection and iteration statements more efficient and versatile
What are examples of selection statements?
IF-THEN-ELSE statements
Nested IF statements
IF-ELSEIF statements
SWITCH-CASE statements
What are examples of iteration statements?
FOR loops
REPEAT loops
WHILE loops
DO WHILE loops