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, 05: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, 06:22 AMmrmatt1111
It is short hand for:

Code:`double theta;`

if(tipHigh == true)

{

theta = -Math.PI/2;

}

else

{

theta = thetaInc;

}

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