Let me see if I understand this correctly.
In a real world setting,
loop would exist alongside other code, and would probably be changed at some point. Let's say line 250 is in charge of changing
loop. If we use the simple (non-function) version:
var loop = 0
while(loop < 3)
loop to 95 while keeping the end result of three iterations would be a lot of work You would also have to ensure that the number on line 2 is always three higher. But if the counting variable is nested and kept separate, then line 250 would only need to say
loop = 95. Always strive to type as little as possible!
How's that? I think this example is more applicable to a
for loop than a
while loop but hopefully it still made sense.