4. Conditional execution Flashcards
What do we mean by conditional execution?
Executing certain instructions under certain circumstances, based on the values of the variables in the program.
How many possible values does a boolean expression have?
Either true or false
How many relational operators are there, and what are they?
1) == - equal
2) != - not equal
3) < - less than
4) > - greater than
5) <= - less than or equal
6) >= - greater than or equal
What are the three parts of an if else statement?
1) A condition or boolean expression.
2) A statement which will be executed when the condition is true.
3) Another statement which will be executed when the condition is false.
What is special about the way we lay out if else statements contained within the false part of another?
We say they are nested, and indent the next if-else statement more, than the first else statement.
What is the relationship between the if statement and the if else statement?
ss
What is the point of putting a list of statements inside a compound statement?
ss