I'm just wondering why the following code does not work (remember what I set ageto nullable):
myEmployee.age = conditionMet ? someNumber : null;
However, the following works just fine:
if(conditionMet)
{
myEmployee.age = someNumber;
}
else
{
myEmployee.age = null;
}
Why can't I set null in a conditional statement? All of these instructions ifin my code are not very pleasant.
Thank.
Paulg source
share