Answered by:
return true and return false

Question
-
Hi Friends.....
what is the difference between return true and return false in C#.Net?...and what it returns?.....can someone revert back with a simple example.....
Best Regards, Arjun- Moved by edhickey Tuesday, May 24, 2011 2:14 PM (From:.NET 3.0/3.5 Windows Workflow Foundation)
Tuesday, May 24, 2011 1:33 PM
Answers
-
"return true" returns true, "return false" returns false.
For example:
bool IsBig(int number) { if(number > 1000000) return true; else return false; }
- Proposed as answer by Seabass008 Tuesday, May 24, 2011 2:41 PM
- Marked as answer by lucy-liu Tuesday, May 31, 2011 6:03 AM
Tuesday, May 24, 2011 2:31 PM -
True and False are boolean type value on the other hand 1,2 3 are integer value and so on..
suppose you have a form and an input Box fo age.
You want to show a message "your age is under 18" or "your age is above 18" then what you do?
you check some condition, if condition meets then it returns true else false.
// this method returns true or false bool isAgeGrater18(int age) { if(age >18) //when condition meets then returns true { return true; } else { return false; } }
hope you are clear.
Hasibul Haque, MCPD http://blog.e-rains.com- Marked as answer by lucy-liu Tuesday, May 31, 2011 6:03 AM
Tuesday, May 24, 2011 3:55 PM -
In addition to Louis answer.
true : http://msdn.microsoft.com/en-us/library/06d3w013.aspx
false : http://msdn.microsoft.com/en-us/library/x4bbw9d7.aspxKind regards,
aelassas.free.fr- Marked as answer by lucy-liu Tuesday, May 31, 2011 6:04 AM
Tuesday, May 24, 2011 7:14 PM -
All replies
-
"return true" returns true, "return false" returns false.
For example:
bool IsBig(int number) { if(number > 1000000) return true; else return false; }
- Proposed as answer by Seabass008 Tuesday, May 24, 2011 2:41 PM
- Marked as answer by lucy-liu Tuesday, May 31, 2011 6:03 AM
Tuesday, May 24, 2011 2:31 PM -
True and False are boolean type value on the other hand 1,2 3 are integer value and so on..
suppose you have a form and an input Box fo age.
You want to show a message "your age is under 18" or "your age is above 18" then what you do?
you check some condition, if condition meets then it returns true else false.
// this method returns true or false bool isAgeGrater18(int age) { if(age >18) //when condition meets then returns true { return true; } else { return false; } }
hope you are clear.
Hasibul Haque, MCPD http://blog.e-rains.com- Marked as answer by lucy-liu Tuesday, May 31, 2011 6:03 AM
Tuesday, May 24, 2011 3:55 PM -
In addition to Louis answer.
true : http://msdn.microsoft.com/en-us/library/06d3w013.aspx
false : http://msdn.microsoft.com/en-us/library/x4bbw9d7.aspxKind regards,
aelassas.free.fr- Marked as answer by lucy-liu Tuesday, May 31, 2011 6:04 AM
Tuesday, May 24, 2011 7:14 PM -
-
Thank you Lucy.
Best Regards, ArjunFriday, June 3, 2011 6:34 PM