[Solved] for Loop commands – which is faster?


To keep it simple,

in case A,

  • your program has to initialize i only once.
  • Assign values to i only array.Length times.
  • Increase i values only array.Length times.
  • do the line execution and comparison 2*array.Length times.

In case B,

  • initialize i twice.
  • Assign values to i 2*array.Length times.
  • Increase i values 2*array.Length times.
  • do line execution and comparison 2*array.Length times.

So, which one you would prefer?

solved for Loop commands – which is faster?