What does this method's return statement return?
Posted
by Kevin
on Stack Overflow
See other posts from Stack Overflow
or by Kevin
Published on 2010-04-28T08:53:48Z
Indexed on
2010/04/28
9:03 UTC
Read the original article
Hit count: 147
c#
I saw a method written in C# that returns a boolean value. The method's return statement looks like this:
return count > 0;
If I'm reading this correctly, it returns a value if count is greater than zero. What happens if the value of 'count' is not greater than 0? What gets returned? Zero? If that's the case, couldn't the return statement just say:
return count;
© Stack Overflow or respective owner