How can I implement this using ternary operator?
if(UnitType == null)
{
a = ElevationType
}
else
{
a = UnitType
}
Ternary operator
a = UnitType == null ? ElevationType : UnitType;
Now I want something like this
if(UnitType == null)
{
if(ElevationType == null)
{
a = StructureType
}
else{
a = ElevationType
}
}
else
{
a = UnitType
}
Can I achieve this using ternary operator? If not, what should be done?
Aucun commentaire:
Enregistrer un commentaire