Alice Community  

Go Back   Alice Community > Educators > Teaching with Alice

Reply
 
Thread Tools Display Modes
Loop
Old
simsman2011
Senior Member
 
simsman2011's Avatar
 
Status: Offline
Posts: 132
Join Date: Jul 2011
Location: somewhere on Earth
Default Loop - 08-06-2011, 07:10 AM

I want to know about loop


==========ــــــــــــــــــــــــــــــــــــــ==============
==========SiMsMaN.....2O11=============
==========ــــــــــــــــــــــــــــــــــــــ==============
   
Reply With Quote
Old
legolizard
Senior Member
 
legolizard's Avatar
 
Status: Offline
Posts: 242
Join Date: Jan 2011
Location: Aboard the Hyperion escaping the zerg.
Default 08-06-2011, 12:23 PM

A loop should be pretty self-explanatory but what it does is check a condition seeing if it is true. If it is then it does the below code. Once it finishes it goes back up to the condiotion and checks to see if it is true, then does the code, then checks conditon. It will continue to do this until the conditon is false. Now in Alice there are two types of loops, the while and for-loop. The for loop tile looks like this:

Capture.PNG

where as the while loop looks like this:

Untitled.png

Here is what is called a flow chart that explains very simply how a while loop works:
Untitled2.jpg

Here is a flow chart for the for-loop:
Untitled3.jpg

Now to actually see real parts of the for-loop click on "view complex verison" of the loop tile after you have dragged it into your method.


"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein

Last edited by legolizard; 08-06-2011 at 09:27 PM.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.