0

Boolean determines value?

What Is the (?5:55) portion of this code doing? I’ve tried google, but I don’t know how to describe It. Also, Is there a chapter In SoloLearn that I could reference? https://code.sololearn.com/c2FUwA4PdnfW/?ref=app

6th Oct 2019, 4:55 PM
Beau Tooley
Beau Tooley - avatar
3 ответов
+ 1
It is called a - conditional operator (? :) OR a ternary operator (it takes three operands). The conditional operator works as follows: The first operand is implicitly converted to boolean value (i. e. Value 0 /1). It is evaluated and all side effects are completed before continuing. If the first operand evaluates to true (1), the second operand is evaluated. Else, 3rd operand is evaluated.
6th Oct 2019, 5:10 PM
Kuri
Kuri - avatar
+ 1
look up ternary operator.
6th Oct 2019, 5:01 PM
rodwynnejones
rodwynnejones - avatar
0
thank you, that answers my question.
6th Oct 2019, 8:41 PM
Beau Tooley
Beau Tooley - avatar