|
|

The boolean tyro

The Boolean Tyro

Yes! ALWAYS write

b=  isAtHome;

instead of the more complicated       

if (isAtHome) {
    b=  true;
}   else {
    b=  false;
}

Avoid unecessary case analysis and if tests.

The next (and last) page explores a slightly different version of this.

 
 
|
|
  
Help | Glossary
© 2002 Copyright Cornell University