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

LOGO-L> What's an or?



Daniel,
You probably have many answers on what an "or" statement is by now. 
Just yesterday one of my students had a program that needed one.

He wanted to make a picture with a train track in it. 
The train track was to go left to right in the center of the screen.
He then wanted to randomly put houses and trees above and below the track.
The "setposrandomly" does random placement but randomly gets in the middle 
of the screen sometimes. 
The student wrote a program using two conditional statements to check to see
what the turtles YCOR was before it was stamped.
It used two if statements to check. Notice how "stampit2" only needs one line
to do the same thing as "stampit" using the or command.
Now he wants to use an and statement with his or…ummmm where is my book?

Walter Smith - Cherry Middle School - Tulare, California - WaltWES@AOL.com


fd100 fd100 fd100 fd100 fd100 fd100 fd100 fd100 


This program placed the turtle randomly somewhere on the screen...(thanks
Michael T.)

to setposrandomly
setpos se(250 - random 500) (250 - random 500)
end

This checked to see if the turtle was in the middle of the screen
where the student had the train track...

to stampit
if ycor > 50 [pd stamp pu]
if ycor < -50 [pd stamp pu]
end

This is the same program but only needs one line using the  "or".
"If ycor is greater than 50 or ycor is less than -50 then do what is in
brackets."

to stampit2
if or ycor > 50 ycor < -50 [pd stamp pu]
end

This puts lots a turtles on the screen. 
The student randomly setsh & setc before stampit was run.

to pix
repeat 250 [setposrandomly stampit2]
end


---------------------------------------------------------------
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