This way, this way … Lesson 3
Starter START Print “Hello, world” STOP Print “What’s your name?” Read in name Print “Hi” and the name Print “Welcome to Logo START STOP
Starter TO HelloWorld PRINT [Hello, world] END TO Hello PRINT [What’s your name?] MAKE “name READWORD PRINT [Hi, ] PRINT :name PRINT [Welcome to Logo] END START Print “Hello, world” STOP Print “What’s your name?” Read in name Print “Hi” and the name Print “Welcome to Logo START STOP
Getting to the activity sheet 1.Go to Start > Internet 2.Go to Departments > Information Technology, Lessons > Year 8 3.Scroll down to and click on ‘GameGirl’ 4.Click on Lesson 3 5.Underneath Activity 2, click on ‘Hello, World’
To do You must –Make a program to print the words “Hello, World” –Modify that program to print whatever words you want. –Draw a square as big as you want and as many times as you want You should –Use a subroutine to draw the square of whatever size you want and as many times as you want –Use the FOR command You could –Do the same as above except for an octagon of whatever size you want
Hello, World! TO HelloWorld PRINT [Hello, World] END TO hello MAKE "name READWORD PRINT [hi, ] PRINT :name PRINT [, welcome to LOGO.] END TO message :text PRINT :text END
Repeating squares TO repeatingsquares PRINT [how many squares do you want?] MAKE "numberofsquares readword PRINT [how big do you want your squares?] MAKE "size READWORD REPEAT :numberofsquares [~ REPEAT 4 [FORWARD :size RIGHT 90] RIGHT 90 FORWARD :size LEFT 90 ] END
Using the SQUARE subroutine TO repeatsquares PRINT [How many squares?] MAKE "repeats READWORD PRINT [How big do you want them?] MAKE "size READWORD REPEAT :repeats [~ square :size RIGHT 90 FORWARD :size LEFT 90 ] END TO square :size REPEAT 4 [FORWARD :size RIGHT 90] END
Using FOR The square subroutine stays the same. The repeatsquare subroutine starts off the same. Replace the REPEAT command with: FOR [i 0 :repeats 1] [~ square :size RIGHT 90 PENUP FORWARD :size + 1 LEFT 90 PENDOWN ]
Doing the same thing with octagons There are only a few changes which need to be made to the program in the “should” section to draw octagons instead. Here’s a clue: TO octagon :size … END And another one: replace ‘square’ with ‘octagon’.