5MAKING A BETTER DANCER

image

The dancing program in Chapter 4 was fairly simple and always instructed your turtle to do the same dance moves. In this chapter, we’ll create a new program that makes the turtle do a variety of random moves. While creating this program, you’ll learn about while loops, the Boolean and nil data types, and how to run or skip code blocks based on conditions.

WRITING A BETTER DANCE PROGRAM

Run the text editor by entering edit mydance2 into the command shell. In the text editor, enter the following lines of code, but don’t type the line numbers because they’re only used here for reference:

mydance2

 1. --[[A Better Dance program ...

Get Coding with Minecraft now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.