Not misleading. Clearly you start by appending “number” (1) to the string, then you append “increment ByOne” (2) to the string when you need to increment by 1, then, logically, you would append “incrementIncrementByOneByOne” (3) to the string when you needed to increment by 1 again, then “incrementIncrementIncrementByOneByOneByOne” (4) when you needed to increment again, and so on.
From looking at how it was used, I’m guessing whoever wrote it intended for it to return a number that increments by 1 every time it’s called. Just didn’t think about it very hard.
To be fair, in the context of this method a global variable wouldn’t have made sense, but there are definitely better ways this could have been achieved ;)
Well if they wanted it to be more than two couldn’t they just have declared the variable static at the class level then pass it as a parameter to incrementByOne and then it would have its desired behavior at least right?
98
u/whattheclap Jun 02 '20
The fact that there’s no argument means that this is probably used to operate with 2 on another number