Coding Express Set

Y-Shaped Track - Conditional Statements

In this lesson students will explore and understand that the Y-shaped track provides options and be able to design and optimize solutions.

30-45 min.


  • Review this lesson plan and choose what you need from the Teacher Support box.

  • If necessary, pre-teach these related vocabulary words: if-then statement, conductor, signal, indicate, switch.

  • Consider the abilities and backgrounds of all your students and decide when and how to introduce and differentiate lesson content, activities, or concepts.

  • Coding Concept: Conditional Statement – if-then statements that modify how code is executed.


  • Tell the students that they’re going to play the “colored tickets game.” Choose at least three spots around the classroom to be “train stops.”

  • Let the students help to name them after their favorite places (e.g., playground, amusement park).

  • Place different color bricks at each stop and use the same color bricks as “tickets.”

  • You can act as the conductor, giving the students tickets according to where they’d like to go.

  • As you hand out the tickets, introduce the use of if-then statements (e.g., if you have a red ticket, then you go to…).

  • Ask the students to walk to their destinations and check whether the brick’s color is same as their “ticket” color.


  • Now the students are going to build their own colored tickets game!

  • Show them the Y-shaped track and the track with a switch.

  • Ask them to build a similar Y-shaped track and at least two stops along the track (see image below for an example).

  • Explain that they should use different color bricks to indicate the stops they’ve built; just like in the game they’ve just played.

  • Choose one student to be the conductor who passes out bricks to be used as “train tickets.”

  • Have each student put a LEGO® DUPLO® figure on the train, sending it to the destination matching their “ticket.” Don’t forget to ask each student where their figure is going.

Tip: Remind the students that they have to guide the train by moving the red switch on the track. Also remind them to use action bricks to make the train stop. Use the term “if-then” after each student is given their ticket.



  • Tell the students that trains give signals to indicate where they want to go.

  • Explain that this isn’t much different from how they’ve just used colored tickets to tell where they wanted to go.

  • Talk to the students about how trains give signals.

  • Ask questions like:

    • What signals can trains give? (Make a “choo choo” sound.)
    • Can trains give signals without making sounds? (e.g., by flashing their lights, giving a color signal, or by how they’re decorated)
    • Which type of signal do you think is best? Why?


  • Encourage the students to use both track switches to build a three-ended or Q-shaped track.

  • Talk about the logistics of running a train on this type of track.

  • Ask questions like:

    • How will you give signals now that you’ll have more destinations?
    • How will you help the train to go back and visit other stops? (By using the green action brick.)


  • Ask guiding questions to elicit students’ thinking and their decisions while ideating, building, and programming.

Observation Checklist

  • Review the learning objectives and educational standards addressed in this lesson (Teacher Support box).

  • Share specific student responses and behaviors at different levels of mastery.

  • Use the following checklist to observe students’ progress:

    • Students can build a y-shaped track and can describe that the train has more than one path to follow.
    • Students can create a conditional statement using the track signals to indicate which conditional or option of track to take.
    • Students can describe the events of the trip, with prompting and support, as different based on the different conditions of the signals.

Teacher Support

Students will:

  • Understand that the Y-shaped track provides options
  • Design and optimize solutions
  • Be able to compare different train track shapes and their uses (i.e., sequencing, looping and conditional statements)

For up to six students

Coding Express set (45025)

  • CSTA 1A-AP-10 Develop programs with sequences and simple loops, to express ideas or address a problem.


  • CCSS.ELA-LITERACY.SL.K.4 Describe familiar people, places, things, and events and, with prompting and support, provide additional detail.