That would require always having a "variable operations - set - 0" for every variable you're using in the game, in an event that must be placed somewhere in the game that it will definitely run before the player encounters any instance of v[123] in a combat formula.
I'm not sure what you're trying to argue any more, because the only case where the variable *could* be undefined is when it hasn't been used anywhere yet. What possible case are you imagining where you're using that notation but don't expect a variable to be undefined?
I'm *not* using that notation while expecting the variable to be undefined, and I'm not trying to claim that there is never a benefit to using that notation. What I'm arguing is against Caethyril's assertion that one should *always* add
|| 0 along with every usage of
v[id]. I was saying that I don't see a reason why it should be a general rule that you *always* do that, because there are going to be cases where you're never expecting the variable to be either undefined or 0, and in those cases, you wouldn't be doing yourself any favors by using that notation.
For example, look at Kes' formula in this thread. It doesn't look like they *want* that variable to ever return a value of 0. They were expecting it to return 60 (not 0), so tacking a
|| 0 into there would have served absolutely no purpose, and I was simply questioning the validity of advising him/her to add a
|| 0. I think that there are likely plenty of situations where your formula might always be expecting the variable to be a non-zero value, and adding
|| 0 to the expression is always going to be an incorrect course of action in those situations. It would serve no purpose, because in the event of that variable being undefined, your damage formula would wind up returning the wrong value regardless.
If you're intentionally planning to use the variable before it ever receives an initial value, and you intend for the initial value to be 0, then sure... in that situation, it makes perfect sense to add
|| 0 to the expression. What I was questioning is whether or not that situation is actually dominate enough that "always add
|| 0" should be a general rule. To me, it seems more like you should add
|| 0 when it makes sense to, and you should not add it when it does not make sense to.