c# - returning Boolean values -
i have piece of code converted c#.
bool checkvalue() { unsigned char ucvalue; method(&ucvalue); return ucvalue? false:true; }
the method() has definition :
this function returns current position . 0 = off 1 = on
so didn't return ucvalue? false:true;
means.
thanks.
this ternary-operator
, can "translate" expression 1:1 c#. same like
if(ucvalue) return false; return true;
from msdn c#:
the conditional operator (?:) returns 1 of 2 values depending on value of boolean expression. following syntax conditional operator.
condition ? first_expression : second_expression;
from here c++:
you can exchange simple if-else code single operator – conditional operator. conditional operator c++ ternary operator (working on 3 values). other operators have seen called binary operators (working on 2 values).
Comments
Post a Comment