EZ Math Movie, Tutorials, Decisions, Not


Not true is false, not false is true.

Sometimes we want to check if something is not true. In EZ Math Movie an exclamation point, !, means 'not'. Here is a simple example that checks if x is not equal to 2:

if(!(x == 2))
{
  print('x is not 2');
}

Note the exclamation point before the Boolean expression (x == 2). So if x were 3, then (x == 2) is false, and not false is true, and the print statement executes.

Another way

Of course, the same operation could be done this way:

if(x != 2)
{
  print('x is not 2');
}

There is often more than one way to accomplish any programing goal. So, if this other way looks clearer to you, go ahead and use it. Let's just say we are presenting the not operator here for completeness and for the unusual or advanced situations you may find where the not operator is the only way to get things done.

Running the example program

The example program shows how to use the ! (not) operator to reverse, or negate, the value of a Boolean statement.


The example program

0ptions
Angle measurement: Degrees Radians

Go on input

Bounds:
Sorry, apparently this browser does not support HTML 5 canvas tag graphics.
Printer

Edit: Runtime          View: Starter Suggestion

To runtime:

Storage:

Editor width: Normal Wide


		

	


		

	


		

	

And....

Next tutorial: The for loop


All contents of EZ Math Movie are copyrighted: Copyright 2011, Edward A. Zobel. All rights reserved.



Other sites you may find interesting

Zona Land Education Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner.

Here is the link: zonalandeducation.com




EZ Programing Demos Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.

Here is the link: ezprogramingdemos.com



Custom Search

Name:
Domain:

Name
0


Name:
Name
0