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 separate code based on a condition.
  • We can add extra conditions with to if/else statements with else if conditions.
  • switch statements make complicated if/else statements easier to read, however they achieve the same result as if/else statements.
  • Comparison operators, like <, >, <=, and >= can compare two variables. After they compare, they always return either true or false.
  • Logical Operators, like &&, ||, !==, and !, can compare two variables to see if a certain condition exists:
    • && checks if both sides are true.
    • || checks if either side is true.
    • !== checks if both sides are not equal.
    • ! changes a variable that is true to false, and vice versa.

In the next lesson, we'll learn about functions, and how to write blocks of code that are reusable.


Press 'Up Next' to continue.

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.