Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WHILE Loop vs FOR/NEXT Loop
#1
Hi, quick question:


Programming styles aside which performs better at run time, WHILE or FOR/NEXT ?

I will guess with both are the same? :-)

Thanks
Reply
#2
Both are nearly the same. But if you are using a counter variable within the WHILE loop, a FOR / NEXT will be optimal because it will increase the variable for you and this is optimized internally during the traduction to assembler.
Reply
#3
(03-13-2022, 11:22 AM)boriel Wrote: Both are nearly the same. But if you are using a counter variable within the WHILE loop, a FOR / NEXT will be optimal because it will increase the variable for you and this is optimized internally during the traduction to assembler.

Thanks for that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)