Objective-C (well really C) has this neat use of the ternary operator where the first part is used if the value is not null. So you can do things like (psuedocode):
button.setLabel(title ?: "Untitled"); // use title, but if it is null use "Untitled"
That said, I personally find overuse of ternaries hard to read and they often require changes down the road when a value becomes something non-binary. I think the english if/else is more clear to beginners.
Totally agree and the
case statements. That is why I like wording
let (just semantically) and dislike the shorthand notation (arrow) for
function. Makes things harder to read for beginners. I must say I like the OR notation
|| for defaults these days. Also, instead of keeping code in an
if statement inside a function I find it easier to just
return a flow (show it right to the door).
Yup! I think there's a way to write code that is more "self documenting" than others, especially to beginners with a potentially smaller vocabulary.
Not that I can use
or because that's more natural (being a native english speaker myself), but have wound up always using
|| because of consistency with other languages and general fluency in my mind.