Lecture 6 Flashcards
(2 cards)
0
Q
If/else:
- What is the if/else control statement?
- Why is the if/else control statement important?
- How to use the if/else control statement?
A
- ~ The if/else control statement is a group of code that tells the program to execute some code (and not others) based on condition
- ~ it allows a program to have logic and branching
- ~ a condition, a block of code that is executed when the condition is true, a block of code that is executed when the condition is false
Syntax:
if ( condition ) { true block
/* statement(s) will execute if the Boolean expression is true /
} else { false block
/ statement(s) will execute if the Boolean expression is false */
}
1
Q
Boolean Expression:
- What are Boolean Expression?
- Why are Boolean Expression important?
- How are Boolean Expression used?
A
- ~expressions that return true or false.
~logical operators:
~> greater than, < less than, >= greater than or equal to, <= less than or equal to, == equal to, != not equal to - ~it allow the program to ask true/false questions
3.