Explain the logic behind...
Could someone please explain the logic behind this:
[B]While[/B] count.variable <= value.variable count.variable set value to (count.variable +1) (blahblahblah) method Count.variable is set to 1 btw. |
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 |
[QUOTE=TauTrumpsPi;42234]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[/QUOTE] Thanks for the info! That helped a lot : ) They are useful when an assessment says no "for loops" as well. lol |
Yeah, that too, "for loops" usually take less time, but this does have it's uses. What language are you using, C, maybe?
|
All times are GMT -5. The time now is 04:56 PM. |
Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.