ternary operator - What does this mean in C# y -= y > 9 ? 9:0; -
while i´m trying understand c# codeblock, i´m asking myself code means:
y -= y > 9 ? 9:0;
thanks in advance
yes bit of code bit confusing.
basically logic reads this:
if y greater 9 subtract y 9 otherwise subtract y 0
this equivalent next code:
if (y > 9) { y = y - 9; } else { y = y - 0; }
the else case of course of study superfluous in case did literal translation.
for farther reading, can check here. luck!
c# ternary-operator
No comments:
Post a Comment