[Back to GSN Home Page] [Back to Message Index]

Global SchoolNet - Automated Message Archive

LOGO-L> ifelse




KERRB@Magill.UniSA.edu.au
Sat, 16 Sep 1995 13:54:27 +0930

Keith Gum wrote:

>I am a struggling beginner trying to hammer out a
>simple math tutor:
>
>To Quiz
>Make "num1 random 10
>Make "num2 random 10
>Make "answer :num1 + :num2
>pr :num1 pr :num2
>correct rl
>end
>
>To correct :response
>if equalp :response :Answer [pr [that's right!]]
[pr[wrong]]
>end

As well as the correction that Michael has pointed out I think you will need an
ifelse, instead of an if.

ie. ifelse equal? first :response :answer [pr "yes][pr "no]

I haven't tested this, you might need a bracket around (first :response)

If only caters for a true response; ifelse caters for [true][false]

Bill Kerr
Paralowie R12 School
South Australia
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.