Bool expression??
-
Then it should be
return x ;
// If I ever catch any of you writing it as
//
// if (x == true)
// return true;
// else
// return false;
//
// I'll have you tied to an anthill and covered in honey!PIEBALDconsult wrote:
I'll have you tied to an anthill and covered in honey!
Cute. This should get a Vote of '5'.
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
No time or effort should be spared in the process of education of the younger generation. Even better would be.
return (x == true) ? true : false;
;P
codito ergo sum
With longer conditions and expressions, ternary operator becomes tedious to debug. X|
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
I found this code somewhere:
...
if (x == true)
return true ;
else
return false ;Actual code was the body of a C# 3 lambda expression. Anyway, horrible.
:eek: So much for just doing a
return x==true;
If x is a bool, then just a simple return of x will work :-\"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
-
I found this code somewhere:
...
if (x == true)
return true ;
else
return false ;Actual code was the body of a C# 3 lambda expression. Anyway, horrible.
I considered creating a new thread for this, but (obviously) decided not to. I spent yesterday at the "Heroes happen {here}" event (in Phoenix) and most of the demoes in the "developers' track" was presented by a "developer evangelist", and it seemed like every one of his methods that returned a
bool
was written in that form. :mad: