Writing Procedures in MSW Logo
A "procedure" is a small piece of code that performs a single task. When writing programs, it is important that you break large tasks up into a series of smaller procedures.
To write a Procedure Using
the Input Box:
STEP 1 - Click in the Input Box.
STEP 2 - Type in "TO" (without the quotation marks)
followed by the name of the procedure. eg TO SQUARE
STEP 3 - Press the Enter key. The User Input Box appears
...
STEP 4 - Enter the lines of code, pressing the Enter key after each
line.
STEP 5 - When all your code is entered type in "END" and
press the Enter key. Your procedure for SQUARE has been defined.
To run the procedure type "SQUARE" (without the quotation
marks) into the Input Box and press the Enter key.
To write a Procedure Using
Editor Window:
STEP 1 - Click in the Input Box and type
in: edit "triangle the Editor Window appears:
STEP 2 - Click at the end of "to triangle" and press
the Enter key to insert a blank line.
STEP 3 - Enter the lines of code to draw a triangle.
to triangle Home CS FD 100 RT 120 FD 100 RT 120 FD 100 RT 120 end |
STEP 5 - Close the Editor Window by selecting File/Exit and answering YES when asked: Contents have changed. Save to workspace? Run your procedure by typing "triangle" into the Input Box and then press the Enter key.