Thursday, December 24, 2009

What is the definition of an iteration in programming?

To loop through a set of commands until a certain condition is met.





Simple example:





a = 0


while a %26lt; 5


a = a + 1


print a


wend





This function will repeat and print the value of ';a';, for as long as a is smaller than 5. The moment a becomes 5, the loop ends; in effect, there are four iterations taking place. (0 - 1, 1 - 2, 2 - 3, 3 - 4)





In this loop:





a = 0


do


a = a + 1


print a


loop until a = 5





there are 5 iterations (0 - 1, 1 - 2, 2 - 3, 3 - 4, 4 - 5) - there's one more iteration in the loop because the condiction is checked *after* it's met.





The same method (only MUCH more complicated) is used to generate fractals - which are nothing more than graphs of complex functions.What is the definition of an iteration in programming?
it means Repetition or Looping








http://www.joxtechnology.com

No comments:

Post a Comment