Hello,
My question is about the If-Else Construct.
I often write If-Else statements that require an action be taken only if something is true. If that something is false, no action is to be taken.
My question is, how do you code "no action".
The following is what i usually code:
As you see above, when false, I usually just assign the variable the value it already has. That's because I want nothing to happen if the result is false.If Variable < 2 Then Variable = Variable + 1 Else Variable = Variable
But isn't that a waste of time for my program? Am i not just giving my processor one more thing to do for no reason. Slowing down my program with unnecessary assignments?
If so, what are my alternatives? Is there a common programming strategy that all programmers adhere to in this situation? I mean, do I just put nothing after the Else Construct (except for a maybe a comment noting the nothingness was intentional)? Hmmm...
Thanks for any help! Trying to be efficient here
Bookmarks