4 ms·
Why does it even execute z++? Shouldn't it stop at 'z' since that is set as the end condition of the for loop?
by chime 16y ago
Why does it even execute z++? Shouldn't it stop at 'z' since that is set as the end condition of the for loop?
- dangrossman 16y ago'z' + 1 is 'aa' which is not less than 'z' lexicographically, so the end condition is NOT met and the loop continues
- brianpan 16y agoThe for loop runs while $i is less than or equal to 'z'.
- jwr 16y agoAlso, one might wonder why it stops at 'yz' instead of continuing on forever. There is no logic in this insanity — you won't know until you try it out.
- zephyrfalcon 16y agoI think it's because the next value, 'za', is neither equal to 'z' nor "less" than it, so the condition fails, and the loop ends.