|
|

The boolean tyro

The Boolean Tyro

Yes! ALWAYS write

return  ! isHappy ;

instead of the more complicated       

if (isHappy)
           return  false;
else   return  true;

Avoid such unecessary case analysis and if tests, and you may not be taken for a boolean tyro!

 

That's the end of this practice session on type boolean.

 
 
|
|
  
Help | Glossary
© 2002 Copyright Cornell University