View
214
Download
1
Category
Preview:
Citation preview
This is taking too long!
Lesson 2 – Subroutines and parameters with LOGO
Do you know what this code is doing?1. REPEAT 4 [FORWARD 100 RIGHT 90]
2. REPEAT 8 [FORWARD 100 RIGHT 45]
3. REPEAT 4 [~ REPEAT 4 [FORWARD 100 RIGHT 90] FORWARD 110]
4. REPEAT 6 [FORWARD 100 RIGHT 60]
To do1. Go to Start > Internet
2. Go to Departments > Information Technology, Lessons > Year 8
3. Click on GameGirl > Lesson 2
4. Click on ‘Subroutines’ underneath ‘Activity 2’.
Saving our work1. In Logo, do the following
a) Go to File > Save Asb) Click on My Documents > Logoc) Save it as ‘Lesson 2 – Subs’
2. Go back to Microsoft Word. In Word, do the following
a) Go to File > Save Asb) Click on My Documents > Logoc) Press ‘Save’
Getting into MSWLogo1. Go to Start > All Programs > Curriculum
2. Go to ICT > MSWLogo
3. Click on ‘EdAll’ at the bottom of the screen to enter in the subroutines.
Using subroutinesTO SQUARE REPEAT 4 [FORWARD 100 RIGHT 90]END
TO SQUARE1 REPEAT 4 [FORWARD 200 RIGHT 90]END
TO OCTAGON REPEAT 8 [FORWARD 100 RIGHT 45]END
TO OCTAGON1 REPEAT 8 [FORWARD 200 RIGHT 45]END
Using variablesTO SQUARE :size
REPEAT 4 [FORWARD :size RIGHT 90]
END
TO OCTAGON :size
REPEAT 8 [FORWARD :size RIGHT 90]
END
The same shape multiple times close together
TO MOVINGSQUARE :size
REPEAT 4 [FORWARD :size RIGHT 90]
FORWARD :size + 10
REPEAT 4 [FORWARD :size RIGHT 90]
…
END
Using the FOR keywordTO MOVINGSQUARE :size :repeat
REPEAT 4 [FORWARD :size RIGHT 90]
FOR [i 0 :repeat 1] [~
RIGHT 90 FORWARD :size + :i
REPEAT 4 [FORWARD :size RIGHT 90]
]
END
Recommended