How to use the
Learning Portal

Learning Portal

Our hands-on, comprehensive lesson plans span a range of levels. Browse our free STEM and coding learning resources.

Marty Image

Change the Argument

What you will do:

Change the arguments to make a program shorter.

What you need to show:

The program has at least 4 fewer blocks than what you started with.


Argument - an argument is a value that tells a program how many times a block should run. This block tells Marty to take one step to the left because 1 is the number for the argument.


Marty V2

A device with Marty the Robot V2 app

Planning paper and pencils

Tape for the floor, like masking tape or other tape

Remember this:

Here is a block of code you have seen before.

This code causes Marty to take some steps and wave. Can you think about how Marty looks doing these actions? Here is a video if you are stuck.

Can you think of a way to shorten the code by changing the arguments for the blocks? Either write your idea on a planning page or use MartyBlocks Jr. If you get stuck, click below to show an idea.

Here is one way to shorten the code

Challenge 1:

Here is a video showing how to make a block of code that makes Marty move from a starting point to an end.

Have a think about what you think Marty is going to do with this code. Create this code in MartyBlocks Jr so you can see Marty move.

Can you think of something you can do with the arguments for the blocks to make this code shorter? Talk with your partners or learning coach about this. When you have created something, test it and compare it with our video by clicking below.

Compare your Marty to ours

Challenge 2:

The following code will get Marty to walk in a zigzag diagonal line.

Create this code in the app to see where Marty goes. Before you press the green flag, mark where Marty starts, and after the code, mark where Marty stops.

Here is a video of Marty starting at an x and stopping at an x.

Can you think of a way to change the arguments for the blocks so that your code is shorter but you still get Marty to the same place at the end? Hint: Marty does not need to make the same movements to get to the end. Use your paper to plan out some code first and think if it will get Marty to the same place. Click below if you would like some help.

Here is a hint with an easier example

Feedback (Here are some questions to think about):

Were you able to make the code shorter but get the same result?

What did you like the most?

What was hard about the activity? How did you fix it?


Click to have a look at some suggested answers. These are not the only answers, they are only ideas for what you can show.

Challenge 1 ideas

This picture shows a different way to have Marty walk the rectangle shape.

Challenge 2 ideas

This picture shows a different way to have Marty get to the stopping point. There is a shorter version of this but Marty will not move the same path.