How would i write the following as a comparison for a while loop or if statement:

verticalVelocity equals 0 and angle.getValue() does not equil 0 or 90

Printable View

- 08-31-2010, 11:35 AMpeterhabeComparisions for while loop
How would i write the following as a comparison for a while loop or if statement:

verticalVelocity equals 0 and angle.getValue() does not equil 0 or 90 - 08-31-2010, 11:42 AMmasijade
Try replacing each of those comparison "phrases" with the corresponding symbols and see what you come up with.

- 08-31-2010, 11:47 AMpeterhabe
I've tried but if you do a direct "translation" into java language you get:

Code:`verticalVelocity == 0 && angle.getValue() != 0 || 90`

Code:`verticalVelocity == 0 && angle.getValue() != 0 || verticalVelocity == 0 && angle.getValue() != 90`

- 08-31-2010, 11:52 AMmasijade
Starting point is your first attempt. Put parens around the rest of the statement after the && and add make the part after the || "complete" (i.e. add the condition you are comparing "90" to).

The second example would also work (but is "wordy") if you put parens around the two "halfs" of the statements (i.e. on each side of the ||).

The thing you are not thinking of is the "grouping". You acheive that through selective use of parens. - 08-31-2010, 11:58 AMpeterhabe
o ye I see it now. thanks