|
|

The boolean tyro

The Boolean Tyro

This if-statement returns a value:

if (isHappy)
         return false;
else return true;

Can you figure out a way to do the same thing with a single return statement? Hint: determine what value should be returned when isHappy is true and when isHappy is false.

Below, write return. Then check your answer.


Feedback

 


|
|
  
Help | Glossary
© 2002 Copyright Cornell University