Bonus: Modify the procedure so that the user can dictate the size of the square or triangle.
to simplechoice
print [Would you like to draw a square or a triangle?]
ifelse readlist = [a square] [repeat 4 [forward 100 right 90]] [repeat 3 [forward 100 right 120]]
end
to bonuschoice
(local "choice "size) ; Local variables store answers to questions.
print [Would you like to:]
print [1. Draw a square or]
print [2. Draw a triangle?]
make "choice readword ; We must store the answer (or use a subprocedure) because we use it twice.
; We use ifelse twice in case the user gives us bad input.
ifelse :choice = 1 [ ; Lots of indents because it didn't work the first time.
print [How big would you like your square to be?]
make "size readword
repeat 4 [forward :size right 90]
] ~
[
ifelse :choice = 2 [
print [How big would you like your triangle to be?]
make "size readword
repeat 3 [forward :size right 120]
] ~
[
print sentence [I'm sorry, I don't know what you mean by] :choice
]
]
end