If the variable needCoffee is true, JavaScript will run one code block, and if a variable is false, it will run another.

needCoffee is the condition we are checking inside the if's parentheses. Since it is equal to true, our program will run the code between the first opening curly brace { (line 2) and the first closing curly brace } (line 4). It will completely ignore the else { ... } part. In this case, we'd see 'Finding coffee' log to the console.

Note: Code between curly braces are called blocks. if/else statements have two code blocks.

If we adjusted needCoffee to be false, only the else's console.log will run.

if/else statements are how we can process yes/no questions programmatically.