.net - c# for loop is entering without meeting its condition -
so, have for loop:
double spec = 0, tot = 0; (int = 0; < omega_algo.length; i++) { if (omega_algo[i] > 0) spec = math.sqrt(omega_algo[i]); else spec = 0; tot += spec; } where myarray.length = 50. indexoutofrangeexception while debugging , see i 50.
so, for loop entering when shouldn't ( i < myarray.length false )!
this exception occurrs ocasionally, makes more weird.
does have explanation/fix this? missing or weird visual studio bug?
edit:
i've edited loop show code.
no i being incremented , omega_algo array not changing @ all.
edit:
based on comments below, wrote sample app, , code should work is.
if array have length of 50, value of i never 50. way possible if changing value of i inside loop.
can provide more code show context of how/where being used? how array being defined etc?
Comments
Post a Comment