Possible Duplicate:
What is a Question Mark “?” and Colon “:” Operator Used for?
Question mark in java code
I am writing codes for a RBG to HSV converter.
I have this line:
var d = (r==minRGB) ? g-b : ((b==minRGB) ? r-g : b-r);
i dont really understand what the “?” and the “:” means here.
Its
Ternary Operator:is equivalent to
It also support nesting i.e.
C = condition1? A : condition2?D:E, which is equivalent to