CSCI 1006 Lecture Notes - Lecture 9: Sliders
➢ Procedures/ Functions
➢ All procedures begin with to and finish with end
o to name [a b c… ] commands end
➢ If you have parameters, they go in [ ] right after the name
➢ Parameters aren’t used that often in net logo
➢ The context is determined by the first command in the procedure
➢ To square [ n ]
➢ Pd
➢ Repeat 4 [
➢ Fd n
➢ Rt 90 ]
➢ Pu
➢ End
➢ Set
➢ Changes a mutable property (Excludes turtles- who, patches- pxcor/ pycor)
➢ Set property value
➢ Set size 5
➢ Set color red (red = 15)
o Colors are numbers. Black ends in 0. White is 9.9. There are only 14 base
colors that are named. These true colors end in 5.
➢ Set shape “turtle” (quotes are necessary)
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
All procedures begin with to and finish with end to name [a b c ] commands end. If you have parameters, they go in [ ] right after the name. Parameters aren"t used that often in net logo. The context is determined by the first command in the procedure. Changes a mutable property (excludes turtles- who, patches- pxcor/ pycor) Set color red (red = 15: colors are numbers. There are only 14 base colors that are named. Turtles directly interact with the patch it"s on top of. Buttons need parameters: use forever button (instead of repeat) Sliders take variables: set variables (1 is standard increment). Boolean operators- and, or, not (goes in front) Comparison operators- >, =, <=, =, != (not equals) If condition is true, commands 1 are executed. If n is a positive integer, return a number such that 0 random < n.