Walterwoj
Walterwoj
Nov 7 · 1 min read

First of all, your psuedo-code is wrong:

int j = i;
i = i + 1;
return j;

Should be:

int j = i;
j = i + 1;
return j;

Your code would not return an incremented value, it would return the original value since you assigned i to j and never used j again until you returned it.

Second of all, that code if poorly done and wastes the extra assignment for the sake of making your point. The correct way to do that is one line with no wasted assignments:

return i +1;

You wrote bad code to prove your point. I highly doubt the library uses such code. Thus your point is moot as long as an experienced programmer wrote the library. If your are going to tell people how to do elementary coding you should write better code yourself (or have someone check your article). Perhaps you aren’t as qualified to tell others how to code as you think….

    Walterwoj

    Written by

    Walterwoj