Computer Science

What are Conditionals?

Conditionals are if/else statements in computer programming.

if/else statements are important blocks of computer programming

Example:

if (condition is met) {

<instructions1>

}

else { //else means condition is not met)

<instructions2>

}

Our program is guaranteed to always go down one of the two paths: either the condition is true and it goes down the first path, or it's false and it goes down the second path.

How are true/falses evaluated?

Computer programs use boolean expressions to determine whether something is true/false.

Boolean expressions return true or false.

For example,

(10 > 9) // returns true

(8 > 10) // returns false

Quiz!

Check your answers!

Quiz Answers:

  1. D

  2. B

  3. A, B, D

  4. A, C, E

  5. B