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

Re: LOGO-L> Start up



David & Janet Taylor wrote:
> 
> I need a source for examples for all the vocab in UCBLogo.  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.
> 

Here are 2 examples from MSWLogo's online help. The examples in MSWLogo
try not to use other parts of the language and focus on the the command
at hand. This is about as simple as you can get.

The main difference is that DO.WHILE runs the "body" or instruction list
first
and then checks on the condition. While the WHILE checks the condition
first.
It depends on the problem at hand as to which is needed.

make "i 0
do.while [make "i :i+1 print :i] [:i<3]
1
2
3

make "i 0
while [:i<3] [make "i :i+1 print :i]
1
2
3

Note that if I did a make "i 4 instead of make "i 0 that DO.WHILE would
still print 5. But WHILE would not print anything because the condition
[:i<3] is never met. do.while will always run the body at least once
regardless of the condition of [:i<3].

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