Archived

This topic is now archived and is closed to further replies.

OT: y=y<0?0:y

This topic is 5847 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
y = y < 0 ? 0 : y

is the same as:

if (y < 0) { y = 0 } else { y = y }

it''s just a shortcut

Share this post


Link to post
Share on other sites
it''s called a Ternary operator

syntax:
(expression1) ? (expression2) : (expression3)
"If expression1 is true,
return the value of expression2;
otherwise, return the value of expression3."

Share this post


Link to post
Share on other sites