Control Flow

Review: Control Flow

Way to go! We just learned a lot of control flow concepts:

  • if/else statements make binary decisions and execute different code based on conditions.
  • All conditions are evaluated to be truthy or falsy.
  • We can add more conditional statements to if/else statements with else if.
  • switch statements make complicated if/else statements easier to read and achieve the same result.
  • The ternary operator (?) and a colon (:) allow us to refactor simple if/else statements.
  • Comparison operators, including <, >, <=, and >= can compare two variables or values.
  • After two values are compared, the conditional statement evaluates to true or false.
  • The logical operator && checks if both sides of a condition are truthy.
  • The logical operator || checks if either side is truthy.
  • The logical operator !== checks if the two sides are not equal.
  • An exclamation mark (!) switches the truthiness / falsiness of the value of a variable.
  • One equals symbol (=) is used to assign a value to a variable.
  • Three equals symbols (===) are used to check if two variables are equal to each other.

Congratulations on learning control flow!

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.