[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> Re: IF syntax



Andrew B. Ritter wrote:
> 
> I am having a bit of a problem with IF syntax.  I have attached a .lgo
> file in which I am trying to capture user input using READCHAR, and
> then  set the color of the pen to red, green, or blue.  Can you point
> out my error(s).  Thanks.
> 
> Andrew Ritter
> aritter@datapex.com
> 
>     ---------------------------------------------------------------
> to pen.color
> 
> print [Which pen color do you want to use (r, g, or b)?]
> make "ans readchar
> if "ans = "r [setpencolor [255 0 0]]
> if "ans = "g [setpencolor [0 255 0]]
> if "ans = "b [setpencolor [ 0 0 255]]
> st
> end

to pen.color
print [Which pen color do you want to use (r, g, or b)?]
make "ans readchar
if :ans = "r [setpencolor [255 0 0]]
if :ans = "g [setpencolor [0 255 0]]
if :ans = "b [setpencolor [0 0 255]]
st
end

Or even better

to pen.color
make "ans selectbox [Choose Color] [Red Green Blue]
if :ans = 1 [setpencolor [255 0 0]]
if :ans = 2 [setpencolor [0 255 0]]
if :ans = 3 [setpencolor [0 0 255]]
st
end

Check out the logo-l mailing list and the Great Logo Adventure Book.
Links to both are on MSWLogo's web page below.

-- 
===============================================================
George Mills (mills@softronix.com)
http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------
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.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home