Greets,

I have seen this syntax numerous times and I'm unsure how it works.

could someone enlighten me?Code:`double theta = tipHigh ? -Math.PI/2 : thetaInc;`

thanks

Printable View

- 09-19-2009, 06:55 AMpoetJava syntax I don't understand - assignment
Greets,

I have seen this syntax numerous times and I'm unsure how it works.

Code:`double theta = tipHigh ? -Math.PI/2 : thetaInc;`

thanks - 09-19-2009, 07:22 AMmrmatt1111
It is short hand for:

Code:`double theta;`

if(tipHigh == true)

{

theta = -Math.PI/2;

}

else

{

theta = thetaInc;

}

- 09-19-2009, 07:47 AMpoet
Ah, thanks a lot :)