Skip to main content

Lesson 2: Repeating Actions

Now that the VR Robot has drawn a square on the Art Canvas Playground using the Pen, you will learn to repeat blocks and simplify your project. This Lesson will walk you through the steps to draw a square on the Art Canvas Playground using the [Repeat] block.

Black Square

Learning Outcomes

  • Identify how to use the [Repeat] block to repeat the blocks inside of it for a set number of times.
  • Identify that the [Repeat] block can accept integers as parameters.
  • Identify that conditions are used to end a [Repeat] block.
  • Describe why a [Repeat] block would be used in a project.
  • Describe the flow of a project that contains a [Repeat] block.

Rename the Project

  • If the previous Lesson’s project is not already loaded, load the Unit3Lesson1 project.
  • Rename the project by selecting the project name box.
    Rename Project
  • Enter the new project name Unit3Lesson2, and select “Rename.”
    Name Project

Repeating Actions

The [Repeat] block is used to repeat the blocks within it a set number of times. The [Repeat] block saves time and effort while creating projects where blocks repeat. Rather than taking the time to drag in additional blocks or duplicate existing blocks in the workspace, the [Repeat] block can be used to save space and time.

  • Begin by modifying the previous project or create a new project to match this base project.
    Repeating Actions
  • The repeated blocks in this project are the [Drive for] and the [Turn for] blocks. Remove the bottom six blocks in the project so only one [Drive for] and one [Turn for] block is left beneath the [move robot pen] block.
    shorten project
  • Drag in a [Repeat] block. Notice that the [Repeat] block will create a gray shadow around the blocks that will be inside when placing the block in the workspace.
    add repeat loop
  • Set the parameter of the [Repeat] block to “4” so a VR Robot draws all four sides of a square.
    repeat callout 4

    For Your Information

    The [Repeat] block can accept integers. Decimals will not work as a parameter for a [Repeat] block.

    repeat block
  • Select the “Playground” button to open the Art Canvas Playground if it is not already open.
    playground
  • Select the “Start” button to test the project.
    play
  • Watch the VR Robot drive forward and turn right four times on the Art Canvas Playground to draw a square with the Pen.
    black square

Select the Next button to continue with the rest of this Lesson.