Zebra0.com

alice user-inputUser Input in Alice3

User Input in Alice3

Using boolean values is usually done with an if statement.
Example:

Boolean earth = this.alien.getBooleanFromUser( "Is this earth?" );
if( earth ) {
    this.alien.say( "Oh good! I thought I was lost." );
} else {
    this.alien.say( "Oh no! I'm lost.!" );
     }
The expression if(earth) means to do the following statmnets if the user selected TRUE, if the user selected FALSE it will do the statements after the else.
We will learn more about Boolean values in a later lesson.

Next: Self Study Questions