Please enable JavaScript to use CodeHS

Introduction to Computer Science in JavaScript (Bulldog)

Lesson 1.10 If Statements

Description

In this lesson, students learn about the conditional statement “if”. Code within an “if statement” will only execute IF the condition is true.

if (frontIsClear()) {
    // Code to be executed only if front is clear
}

Objective

Students will be able to:

  • Use conditions to gather information about Karel’s world (is the front clear, is Karel facing north, etc)
  • Create if statements that only execute code if a certain condition is true

Activities

These are all the activities included in the lesson

1.10.1 If Statements
1.10.2 If Statements Quiz
1.10.3 If Statements
1.10.4 Safe Take Ball
1.10.5 Is There a Ball?
1.10.6 Don't Crash!