StudyBrixFree worksheets, study guides and courses

Computer science · Grades 2–4

IF, THEN, ELSE

Study guide for Grades 2 to 4: 2 worked examples and 2 practice questions. Check the condition first. Only one branch runs: THEN when it is true, ELSE when it is false.

Make a worksheet

Rule and key idea

Check the condition first. Only one branch runs: THEN when it is true, ELSE when it is false.

IF condition is true → THEN part · otherwise → ELSE part

Worked examples

Rule: IF the number is equal to 13, THEN say “big”, ELSE say “small”. The number is 10. What does the program say?

10 is not equal to 13: the condition is false, so the ELSE part runs.

small

Rule: IF the number is greater than 6, THEN say “big”, ELSE say “small”. The number is 4. What does the program say?

4 is not greater than 6: the condition is false, so the ELSE part runs.

small

Try two questions

  1. Rule: IF the number is greater than 16, THEN say “big”, ELSE say “small”. The number is 18. What does the program say?

    1. big
    2. small
  2. Rule: IF the number is less than 18, THEN say “star”, ELSE say “moon”. The number is 20. What does the program say?

    1. moon
    2. star

Answers and reasoning

Answers and marking notes
  1. big

    18 is greater than 16: the condition is true, so the THEN part runs.

  2. moon

    20 is not less than 18: the condition is false, so the ELSE part runs.

How this page was made: written for StudyBrix with AI assistance from our own templates. Answers and worked examples are checked by automated tests, and grade bands are approximate, not an official curriculum alignment. See the editorial policy for corrections. Editorial policy