Return to Snippet

Revision: 30130
at August 8, 2010 09:51 by goatboy91587


Updated Code
//declare an int with a value of 5 and boolean
var five:int = 5;
var bool:Boolean;

if (five > 6)
{
	bool = true;
}
else
{
	bool = false;
}

//when comparing booleans, always make sure to 
//use two '=' signs, otherwise you'll set the 
//value of the variable to what you are trying
//to compare. This is called a logical operator.
if (bool == true)
{
	trace("This should actually be false. The value is 5, " +
		  "greater than 6.")
}
else
{
	trace("The value of the int is 5.");
}

Revision: 30129
at August 8, 2010 09:46 by goatboy91587


Initial Code
//declare an int with a value of 5 and boolean
var five:int = 5;
var bool:Boolean = false;

if (five > 6)
{
	bool = true;
}
else
{
	bool = false;
}

//when comparing booleans, always make sure to 
//use two '=' signs, otherwise you'll set the 
//value of the variable to what you are trying
//to compare. This is called a logical operator.
if (bool == true)
{
	trace("This should actually be false. The value is 5, " +
		  "greater than 6.")
}
else
{
	trace("The value of the int is 5.");
}

Initial URL
http://www.brettwidmann.com

Initial Description
Used for the blog post: http://www.brettwidmann.com/2010/08/flash-primitive-data-types

Initial Title
AS3 Boolean Example

Initial Tags
flash

Initial Language
ActionScript 3