Learn CS Visual

How Conditionals Work

A conditional switches which code runs, based on whether a condition is true or false. An if statement runs one branch when its condition is true and the other branch when it's false. In the same program, a variable's value can change the condition's result, and with it, which path actually runs.

When x is 8, what's the result of x % 2 === 0?