On 27-Jun-97, David & Janet Taylor wrote:
>I need a source for examples for all the vocab in UCBLogo.
ALL of them? That's a tall order.
>I cannot get
>the do.while and do.until to work for me because the samples are to
>cryptic. I will need to check the archive for a while until I s-bscr-b-.
>If you have a really hot tip, drop me an email direct. Thanks.
Lessee... Those are library procedures. They look pretty straightforward.
Something like...
to zrand
local "z
do.until [
make "z random 100
print :z
] [:z>95]
end
zrand
It will print random numbers until it hits one greater than 95. You can do
exactly the same thing with do.while:
to zrand
local "z
do.while [
make "z random 100
print :z
] [:z<96]
end
zrand
The only difference is that do.while exits when its condition is FALSE, and
do.until exits when its condition is TRUE. This stuff is pretty standard in
procedural type languages. In fact, these procedures are probably most useful
for porting code from BASIC or somesuch to Logo. You probably want to avoid
them when writing actual Logo code. The natural Logo way of doing the above
would be more like...
to zrand :z
print :z
if :z<96 [zrand random 100]
end
zrand random 100
--
Tony Belding
http://hamilton.htcomp.net/tbelding/
---------------------------------------------------------------
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