Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Adroit798y@jckimble lol..just so that she doesn't comes back to me asking "why counting from zero?" 😝
-
I think what you did could potentially inspire her to learn programming. It kinda did for me, but those days we used to actually write in actual paper.
-
nmunro31888yIf I were a teacher I'd reward the first student who did it for being creative but then in class demonstrate the solution and that anyone handing in the same solution would not be rewarded.
If however they used a different language or say a while loop, I would reward that.
Redeemed by creativity, further punished by simply copying another student. -
Rocco2598yActually, the following is slightly more performant:
for (count = 500; count > 0; --count) -
-
Rocco2598y@jckimble @adroit It goes down to how it is handled on the processor / in assembler. Compare against zero is a standard operation. For other values the value must first be loaded into a registry and then the compare is done against the registry value.
Nowadays the effect is probably neglectable, but in the old days it could make a difference.
Related Rants
My little sister was ranting about a punishment she got from her teacher. I told her to write this instead...Was this the wrong thing to do or it's just me... :P
undefined
c