Re: interpretation help of ?:




"Petterson Mikael" <mikael.petterson@xxxxxxxxxxxxxxx> wrote in message
news:444F2665.7010105@xxxxxxxxxxxxxxxxxx
Simon wrote:
Petterson Mikael wrote:

How shall i interpret the use of ?: operator in the code below?


Well, your code is slightly confusing since you have a nested usage of ?
and :
In general,

a = condition ? thenVal : elseVal;

is equivalent to

if (condition) {
a = thenVal;
} else {
a = elseVal;
}

In your code, thenVal is again an expression of this kind.

Cheers,
Simon

Thanks that helped :-)


It's called a "ternary expression" if you want to Google for more
information or examples.

--
Rhino


.