Relational Expressions

Slides:



Advertisements
Similar presentations
Decision Structures Chapter 4. Chapter 4 Objectives To understand: o What values can be stored in a Boolean variable o What sequence structures are and.
Advertisements

Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
July 13 th.  If/ Else if / Else  Variable Scope  Nested if/else's  Switch statements  Conditional Operator.
Programming: Simple Control Structures Alice. Control Statements We have been using Do in order and Do together to control the way instructions are executed.
Lesson Objective: I can…
You can type your own categories and points values in this game board. Type your questions and answers in the slides we’ve provided. When you’re in slide.
Shorter of two objects and changing color Functions, events and setting the color Susan Rodger, Duke University June 2008.
This will let you see the game you are going to play on the inside. It will help you see what all goes into creating instance to that goes into setting.
Branching and Looping Examples, cont’d. Remember the generic triple jump world…
Making a Boat Racing Game in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2010.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Decision Structures Chapter 4 Part 2. Chapter 4 Objectives To understand o What relational operators are and how they are used o Boolean logic o Testing.
Agenda Exam #1 Review Modulus Conditionals Boolean Algebra Reading: Chapter Homework #5.
Chapter 3 Selections Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved
By Melissa Dalis Professor Susan Rodger Duke University June 2011 Multiplication Table.
A Simple Quiz: Ask User Functions. By Lana Dyck under the direction of Professor Susan Rodger Duke University June 2009, added Part 2 July 2011.
Can I get your number? By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Balancing the scales: Inequalities By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Solving One-Step Equations Jennifer Barrall 9 th Grade Algebra Click to Continue.
Nonvisual Arrays by Chris Brown under Prof. Susan Rodger Duke University June 2012.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
CompSci 4 Chap 6 Sec 2 Sep 30, 2010 Prof. Susan Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not a Flutterbudget.
Solving Inequalities Using Addition & Subtraction.
CS320n –Visual Programming Execution Control with If / Else and Boolean Functions (Slides 6-2-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for.
IF STATEMENTS AND BOOLEAN EXPRESSIONS. BOOLEAN EXPRESSIONS Evaluate to a value of true or false Use relational or equivalence operators Boolean operators.
Computer Science 1000 LOGO II. Boolean Expressions like Excel and Scratch, LOGO supports three Boolean operators less than (
Creating a UFO Rescue Game in Alice
A Simple Quiz for Alice 3.2:
Graphing Inequalities
Making Choices with if Statements
Comparative Relational Thinking
Chapter 2 Section 8.
IF statements.
Equations with Variables on Both Sides
Asking User for an Answer Alice 3 Tricks in Mini Trivia (2/4)
Mathcad Basics The Mathcad does not require any programming language to perform simple operations. The Mathcad follow the precedence of operation such.
Simple Control Structures
Expressions and Control Flow in JavaScript
Let's Race! Typing on the Home Row
Creating a UFO Rescue Game in Alice
Using Addition & Subtraction
Microsoft Visual Basic 2005 BASICS
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Chapter 2 Section 8.
Prime, Composite, FACTORS, and Multiples
Using Addition & Subtraction
Computers & Programming Languages
A Simple Quiz for Alice 3.2:
Design and Implementation
Checking for Collisions: Using Functions in Alice
 Click on a present to go to a question
Using Functions
Programming: Simple Control Structures
Equivalent Expressions
Computer Science Core Concepts
Find the reference angle for the angle measuring {image}
Using Lists and Functions to Create Dialogue
Using Addition & Subtraction
Presentation Companion Slide Pack
POSITIVE AND NEGATIVE + -
SECTION 2-4 : SOLVING EQUATIONS WITH THE VARIABLE ON BOTH SIDES
CS2011 Introduction to Programming I Selections (I)
Relational Operators.
Using Addition & Subtraction
If-Statements and If/Else Statements
Using Addition & Subtraction
The Properties of Mathematics
under the direction of Professor Susan Rodger
True or False True or False
Decision Statements.
Presentation transcript:

Relational Expressions http://www.alice.org/resources/lessons/relational-expressions/

Relational Expressions What is a Relational Expression A way to compare to entities that resolves to true or false. A relational expression can be used to resolve for the boolean data type. They are often used to inform conditional expressions such as if_else and while_ The basic equations are ==, ≠, <, ≤, >, ≥. In Alice we have also added text comparisons for equals, starts with, contains, and ends with.

Relational Expressions How to Construct You can access the relational expression menu anywhere that you have a boolean data type. Traditionally the two places you will construct relational expressions is in the if_else and while_ control structures to determine which outcome to return.

Relational Expressions Using a Variable A relational expression with all constants will always resolve to the same outcome. To create a truly conditional statement you will want to add a variable to the relational expression. This could be: A variable that is altered elsewhere in the program A function that changes based on user input or randomization To add a variable or function just create an expression using placeholders and drag the variable or function into the statement being sure to match data types.

Relational Expressions Extending an Expression You can use the both_and or the either_or to create relational expressions that have multiple comparisons that need to be met.

Relational Expressions Common Uses Some of the common uses of relational expressions in Alice are: If score is greater than or equal to 10 win game If textFromUser contains y then answer is correct If keypress is up arrow move forward If object clicked equals bear animate bear