I have a problem. I will only declare a variable if that satisfies my condition.
if(//some condition1)
var some1=1;
else if(//some condition1)
var some2=2;
Now
var some3=some1+some2;
if two conditions are met, it is okay to have sum in some3;
if only one condition is met, I want to have either some1
or some2
in some3
How can I achieve this?
Note: Thanks for answers But i want to declare variables only if that condition is met. Is there any other solution?