[Gambas-user] For...Next loop efficiency question

Kevin Fishburne kevinfishburne at ...1887...
Thu Feb 23 06:16:36 CET 2012


If the ranges of a For...Next loop require calculations, are they slower 
than a loop which doesn't? In other words, is the first example below 
faster than the second?

For Counter = 1 To 100
Next

For Counter = 100 / 100 + 1 - 1 To 100 / 100 + 1 - 1 + 99
Next

Does it make any difference if the calculations use variables versus 
explicit numbers like in my example?

Modifier = 100
For Counter = 1 + Modifier To 100 + Modifier
Next

I guess what I'm getting at is, is the calculation performed once at the 
beginning of the loop, or is the calculation performed repeatedly, after 
every Next?

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list