Exercise Weekend

Goal: In the Assignment and Comparison Operators lesson, we learned:

  • The difference between = and ===
  • The += assignment operator
  • Comparison operators, including <, >, and ===

Take time to practice using each of these operators by completing the exercises listed below.

Warm Up

  • What is the difference between a comparison operator and an assignment operator?
  • What is a boolean? What does it represent?
  • How is the += operator different than the + operator?


Assignment & Comparison Practice

Practice assigning and comparing:

  • Set two variables equal to two different numbers. Use a comparison operator to compare these two variables. Change one of their values by using the +=, -=, *=, or /= operator. Then, compare their values again.
  • Try out the <= and >= operators.
  • Try to use the !== operator.