Boolean Operators: <, >, <=, >=, and ==

In the movie below the message on the right and stops in the center. In this movie we only move the message if message.x>60.


Get Adobe Flash player
Download the flash file

The code is shown below:

//The message enters on the right  and stops in the middle
this.addEventListener(Event.ENTER_FRAME,frames);
function frames(e:Event): void {
if(message.x>60) {
message.x=message.x-2;
}
} //frames

A Boolean expression can do a comparison using any of the symbols below:

Symbol Meaning Example;
<
less than
if(a<b)
>
greater than
if(a>b)
==
equal
if(a==b)
!=
not equal
if(a!=b)
<=
less or equal
if(a<=b)
>=
greater or equal
if(a>=b)

Experiment: Make the mesage move up from the bottom and stop when it gets to the middle.


INDEX, Boolean Properties, Moving Ball: Using if, Greetings: Boolean Operators, Bouncing Ball: Using OR, Clicker Clown: Using Else, Making Tea using switch
Next lesson: OOPs: Object Oriented Programming

Copyright © Zebra0.com
All rights reserved worldwide.

 
 

Greetings: Boolean Operators