Question about Bucky's 59 tutorial

+1 Pavel Andrei · September 6, 2016
What does (a<b?a:b) mean ?What's each character's role ?Bucky didn't explain in detail in the video

Post a Reply


Oldest  Newest  Rating
+2 Scott Walker · September 9, 2016
a<b - The evaluation, is a less than b?

a:b - If it is true, return A otherwise return B
0 Pavel Andrei · September 9, 2016
Thanks for the help
+1 Ankur Ghosh · September 10, 2016
this is short for if sentence. the first part means the condition which in this case is a<b. the first character after question mark is executed if the code is true and the second part after colon is executed when the statement is false. 
+1 Tiago Campos · September 10, 2016
It's called the Ternary Conditional Operator.
If a < b is true, then it will execute a. If a < b is false it'll execute b.
In a if else statement that code looks like this:
if(a < b) a;
else b;
+1 Leticia Rabor · September 10, 2016
Looks like a ternary operator.  It's a condition statement.

a < b ? a : b is the same as saying

if (a < b)
    return a;
    return b;
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator