Zebra0.com

alice booleanAlice Programming

Alice Programming

Learn Alice in FREE step-by-step lessons.

Module 12: Boolean Expressions: true or false

Sometimes a programmer would like one statement, or group of statements to execute only if certain conditions are true. There may be a different statement, or group of statements that are to be executed when the condition is false. An expression that can be evaluated to true or false is called a Boolean expression. (Named after a mathematician named Boole who developed Boolean algebra.)

In this module, you will use Boolean Expressions. Boolean expressions are ones that can be evaluated as true or false.
You will use if/else control structures to control which code to execute.
You will perform tasks such as asking the user a question and tell if the answer is right.
Your Guessing Game program will ask the user a series of questions. You will use Boolean expression to determine if the answer is right or wrong and tell the user his score at the end of the quiz.

Goal:

In order to do this you will:

Objectives:

Print the lesson

Please study the material at each of the links below.

  1. Ask if it is nighttime Ask if it is nighttime: The function getBooleanFromUser gives a choice of true or false.
    /alice/videos/alice-boolean.mp4

  2. Using Boolean Expressions in If Block Using Boolean Expressions in If Block: Ask if Thor is happy, he says ha-ha or boo-hoo
    /alice/videos/alice-boolean-if.mp4
  3. Pass or Fail Pass or Fail: Compare a score to 65 and say "Pass" or "Fail"
    /alice/videos/alice-pass-fail.mp4
  4. Child or Adult? Comparing values Child or Adult? Comparing values: Compare age to determine if child or adult
    /alice/videos/alice-child-adult.mp4
  5. Restaurant? Using AND: && Restaurant? Using AND: &&: Need restaurant with hamburgers and pizza
    /alice/videos/alice-restaurant.mp4
  6. Teenager? Using AND: && Teenager? Using AND: &&: You are a teenager if age >=13 AND age <= 19
    /alice/videos/alice-teenager.mp4
  7. Panda says "Whee!" if turning fast: Panda says "Whee" if amountToTurn > 2.0

  8. Who is taller? Finding larger of 2 Who is taller? Finding larger of 2: Use the function getHeight to find the taller of two animals
    /alice/videos/alice-taller.mp4
  9. A Quiz Game A Quiz Game: This video shows how to create a quiz and keep track of number right.
    /alice/videos/alice-quiz.mp4
  10. A True/False Question: Using if to tell the user the answer is right.

  11. A drill on Boolean values A drill on Boolean values: See if you can do these comparisons

  12. The user is offered coffee and tea The user is offered coffee and tea: See if you can add another choice
    /alice/videos/alice-coffee-tea-soda.mp4
  13. The seagull asks how many penguins there are. The seagull asks how many penguins there are.: See if you can add to this project
    /alice/videos/alice-how-many-penguins.mp4
  14. Self Study Questions Self Study Questions: What have you learned?

  15. Discussion Questions Discussion Questions

Active Learning

Create a guessing game or quiz.

GlossaryGlossary for boolean lesson
Full Glossary