Sure there is a lot of ways. There is little chance "2" will change but still I don't like it because is not clear what that means...well of course we know it...anyway you see what I mean. Matter of taste.
For sure on my "real" code I don't use 2 times a function in a row...but on a forum it's good enough ;-)
Sure there is a lot of ways. There is little chance "2" will change but still I don't like it because is not clear what that means...well of course we know it...anyway you see what I mean. Matter of taste.
For sure on my "real" code I don't use 2 times a function in a row...but on a forum it's good enough ;-)
I usually use a "switch":
This way I can also add code specific to the type if need be, within the "switch" statement.