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

Emil Lenngren emil.lenngren at ...626...
Thu Feb 23 09:04:33 CET 2012


The calculation is done only once in the beginning of the loop.

/Emil

2012/2/23 Kevin Fishburne <kevinfishburne at ...1887...>

> 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
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list