+ 1
Hello, what is mean (a?b :c) ?
4 Answers
+ 4
Ternary is mentioned in the first slide of this lesson.
https://www.sololearn.com/learn/Swift/2337/?ref=app
... and the second slide of part 2:
https://www.sololearn.com/learn/Swift/2338/?ref=app
+ 2
It means:
Is a true? In that case b: else c.
Does that clarify it?
+ 2
that is the ternary operator.
condition ? expression_for_true : expression_for_false.
if the condition is true (or it is truthy) the first expression is returned, in the general form written above that would be expression_for_true. otherwise, if the condition evaluates to false (or is falsy) it returns the second expression, from the above example it returns expression_for_false.
Besides false, possible falsy expressions are: null, NaN, 0, the empty string (""), and undefined.
+ 1
it means is "a" true?
if NOT? check "b" : is "b" true?
else?? check "c"