Alice Community Explain the logic behind...

 Explain the logic behind...
 fallout87 Junior Member   Status: Offline Posts: 11 Join Date: Oct 2011 Location: Small Country Town Explain the logic behind... - 10-07-2011, 09:35 AM Could someone please explain the logic behind this: While count.variable <= value.variable count.variable set value to (count.variable +1) (blahblahblah) method Count.variable is set to 1 btw.
 TauTrumpsPi Senior Member     Status: Offline Posts: 399 Join Date: Mar 2011 Location: The diamond layer 10-07-2011, 09:03 PM That is called a count controlled while loop. Basically, it is a loop statement It will execute the method the value of the value.variable times So, look at it like this Counter = 1 Flag = 3 While Counter <= Flag count.variable set value to (Counter + 1) (blahblahblah) method So, the (blah) method will execute until the counter exceeds the Flag, in which it will stop. This is usually only useful in languages that don't have loop statements -------------------------------------------------------------------------------------------------------------------------- I have plenty of common sense. I just choose to ignore it. -Calvin and Hobbes Wondering about my Avatar? http://en.wikipedia.org/wiki/Tardigrade Wondering about my username? http://www.youtube.com/watch?v=jG7vhMMXagQ
fallout87
Junior Member

Status: Offline
Posts: 11
Join Date: Oct 2011
Location: Small Country Town
10-13-2011, 03:10 PM

Quote:
 Originally Posted by TauTrumpsPi That is called a count controlled while loop. Basically, it is a loop statement It will execute the method the value of the value.variable times So, look at it like this Counter = 1 Flag = 3 While Counter <= Flag count.variable set value to (Counter + 1) (blahblahblah) method So, the (blah) method will execute until the counter exceeds the Flag, in which it will stop. This is usually only useful in languages that don't have loop statements

Thanks for the info!

That helped a lot : )

They are useful when an assessment says no "for loops" as well. lol

 TauTrumpsPi Senior Member     Status: Offline Posts: 399 Join Date: Mar 2011 Location: The diamond layer 10-14-2011, 03:38 PM Yeah, that too, "for loops" usually take less time, but this does have it's uses. What language are you using, C, maybe? -------------------------------------------------------------------------------------------------------------------------- I have plenty of common sense. I just choose to ignore it. -Calvin and Hobbes Wondering about my Avatar? http://en.wikipedia.org/wiki/Tardigrade Wondering about my username? http://www.youtube.com/watch?v=jG7vhMMXagQ

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge