Passing Values into Procedures
The usual definition "to square" is of the form: repeat 4[fd 20 rt 90] This will draw a square with each side 20 units long.
A more flexible approach is to write the procedure so that a value can be passed to it at "run time". This is done using the colon (":") after the procedure name in the "to" line.
to square :sides
repeat 4 [fd :sides rt 90]
end
The procedure is called using the procedure name followed by a space and then the value to be passed. eg SQUARE 50 will draw a square of sides 50. square 20 will draw a square of sides 20 and so on.
NOTE: You can pass a number of values into a procedure.