re: Towards zero bugs VIEW POST

FULL DISCUSSION
 

Off by one errors: The loop that you indicated (for (let i = 0; i < 10; i++)) actually does run 10 iterations (index 0 to 9).

Values vs. references: This was a huge issue for me for the first couple years of programming. Languages like JavaScript where the pass-by-value for PoD/pass-by-reference for objects is not obvious to a beginner doesn't help either. If you have a reference and you need a unique copy, but your object is made up of a bunch of references itself and those all need to be copies, things get hairy really quickly. I prefer "dumb" languages like C for this reason. Everything is a copy unless otherwise specified as a pointer, so you don't have to waste any brainpower trying to figure out whether something is a reference or a copy.

 

Thanks for identifying the error in the ‘off by one’ code. I have corrected the error.

code of conduct - report abuse