Lecture 6 Flashcards

(2 cards)

0
Q

If/else:

  1. What is the if/else control statement?
  2. Why is the if/else control statement important?
  3. How to use the if/else control statement?
A
  1. ~ The if/else control statement is a group of code that tells the program to execute some code (and not others) based on condition
  2. ~ it allows a program to have logic and branching
  3. ~ 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 */
    }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

Boolean Expression:

  1. What are Boolean Expression?
  2. Why are Boolean Expression important?
  3. How are Boolean Expression used?
A
  1. ~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
  2. ~it allow the program to ask true/false questions
    3.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly