# Control Flow

## Objectives

* Describe the benefits of altering control flow in JavaScript
* Use boolean statements to return true and false values
* Utilize if/else statements in order to skip blocks of code
* Identify truthy and falsey values
* Utilize for, for...in, and while loops to loop through data structures and repeat code

## Control Flow

Control flow is the order in which the computer executes statements in a script. Javascript executes top-to-bottom, *unless we alter the control flow*.

**Why/how would we alter the control flow?** 1. Skip lines of code based on a condition. 2. Repeat lines of code when traversing a data set or just for the sake of DRY code.

**What kinds of statements do you remember from the prework that changed control flow?**

**Here are some statements we can use to alter the control flow:** 1. [if](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else) 2. [switch](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch) 3. [while](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while) 4. [for](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for) 5. [for...in](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)

But before that, let's create the expressions needed for these statements.
