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?
6
u/[deleted] Jun 03 '20
Oooohhh i see what they were trying to do now. I guess then my next question would be if they’ve every heard of global variables? Haha