<< Chapter < Page Chapter >> Page >
The purpose of this module is to teach you how to use the forever block and the repeat until block to create loop structures in Scratch 2.0.

Table of contents

Preface

Scratch 2.0 (released May 9, 2013) is the second major version of Scratch to be released during the life of the product. Among other things, it features a redesigned editor andwebsite, and allows you to edit projects directly from your web browser.

This module (tutorial) is one in a collection of modules designed to help beginners of all ages (8 and up) learn how to create the code for computer programs using Scratch 2.0 . Information is provided not only for the beginners themselves but also for theirparents and teachers where appropriate.

The purpose of this module is to teach you how to use the forever block and the repeat until block to create loop structures in Scratch.

In this module, I will present and explain three Scratch programs. One program uses a forever block along with an if block to cause a sprite to move in a small circle while the space bar is pressed. Youwill learn that it is not possible to connect another block to the bottom of a forever block. Therefore, if you use a forever block, it must be the last block in the script in which it is contained.

The second program uses a forever block along with an if block to create a counter loop. That program will be used as the jumping-offpoint for a discussion of the similarities and differences between a forever block and a repeat block.

The third program uses a repeat until block to cause a sprite to run in a small circle until the user presses the space bar. Unlike the forever block, it is possible to connect another block to the bottom of a repeat until block. Therefore, it is not necessary for a repeat until block to be the last block in a script.

Finally, I will provide the specifications for a student-programming project for you to demonstrate your understanding of what you learned from the threeprograms listed above and from earlier modules.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Teaching beginners to code. OpenStax CNX. May 27, 2013 Download for free at http://cnx.org/content/col11498/1.20
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Teaching beginners to code' conversation and receive update notifications?

Ask