Given the following code
int j = 0;
for (int i = 0; i < str.Length; ++i) {
if (i==j) {
Console.WriteLine ("equal");
}
j++;
}
I expected that ++i
would change i
from initial 0
to 1
and thus i==j
evaluated to false
.
But it did not. Why?