3.6 Conditionals

0 阅读1分钟

1. Exam Points

  • select the correct algorithm based on a given scenario.
  • Choose between selection (if…else) and iteration (loop).
  • if and if…else statements.
  • Predict output of given algorithms using conditional statements.
  • Understand flow charts and figure out the algorithms represented by a given flow chart.

2. Knowledge Points

(1) Conditional Statements

  • Selection determines which parts of an algorithm are executed based on a condition being true or false.
  • Conditional statements affect the sequential flow of control by executing different statements based on the value of a Boolean expression.
  • Commonly used conditional statements:
    • if
      image.png image.png
    • if...else
      image.png image.png

3. Exercises