Selection Flashcards
What are selection blocks all about?
Making decisions
What are the 3 building blocks of programming?
Sequence, Selection and Iteration.
What do you need after an ‘IF’ line?
Colon
What is an indent?
The code in a selection block is indented, so you use tab to move the code over.
When is an ‘IF’ block activated?
When a condition is true.
What is a common structure for an ‘IF’ statement?
If/Else or If/Elif/Else or If/Then/Else.
What is another common structure for an ‘IF’ statement?
If/Else or If/Elif/Else or If/Then/Else.
What is another common structure for an ‘IF’ statement?
If/Else or If/Elif/Else or If/Then/Else.
What happens when an ‘IF’ statement is false?
Nothing unless there is an else or elif which navigates the code elsewhere.
Is an ‘IF’ statement just for one statement?
No, an ‘IF’ statement can be used to see if multiple expressions are true or not.
What do ELSE - IF statements check until?
One statement is true.
Other than checking if a statement is true or false, what else can an if statement check for?
If a variable is equal to a certain value.
What do nested if statements allow?
Multiple outputs.
What is nesting?
Embedding code within other code.