Campbell Ritchie wrote:I presume that means you worked it out?
Nah, not really but didn't want to be a pain. I don't think I'm understanding the for...while loop. It makes perfect sense to me that the result would be cumulative
when it's explained (like 2*2, 4*2, etc.) but I don't understand why it does that within the loop if when it loops back the result is always
equal to 1. Obviously the answer is the result changes but I don't understand the logic of the loop to know why. Meaning, if the result goes from 1 to 2 I don't
understand why the result=1; in the main loop changes to 2 rather then continuing to be 1. It's more I've never seen that whereas I've seen the structure
(i=0; i < 10; i++) a lot to know what to expect. I completely understand the result changes from 1 to 2 to 4 but I don't understand the underlying form
of the loop or why it does that (if that makes sense).
e-- still makes no sense to me and I don't see why it's even needed. My thinking is wrong but in my mind if I see:
(i=4; i < 10; i++)
and e is then equal to the original i (4) or the i++(5), I don't see how in either condition it would make sense to subtract one from it.
I'm ultimately not understanding the underlying logic. It's not even so much this problem as just being aware for when it comes up
with possibly more complex problems in the future.
Ah well, I'll just keep staring at it.