Is there a way to shortcut checking if a variable is nil, and give a default value if it is?
For instance, replace
result = (var == nil ? defaultvalue : var)
by something like
result = selfifnotnil(var, default)
Of course I could write selfifnotnil function like the ternary above, but is there any built in option?
Aucun commentaire:
Enregistrer un commentaire