Forgot username/password? Don't have an account?
Login with Facebook
Home » Courses » Coding Basics 2 » Boolean
Subscribe for updates.
* New to us? log in with Facebook and get a free day pass


We have learned and used all but one last primitive variable. Are you ready to see it in action? Booleans are simple! They are really only place-holders that can hold only one of two possible values: true or false (0 or 1, yes or no...)

Boolean values can be used to state whether a statement is right or wrong. It has only two options: true or false. We may also take this as 0 or 1 if we are using some other programming languages like c and c++. A Boolean value is like a switch which has only two options: on or off.

Assigning and working with Boolean Variables

We can assign a Boolean value to a variable using var a:Boolean = true;. This means the variable is declared as a Boolean value and the option true is assigned to it. We can't assign any other value (such as string or number) to this Boolean variable other than true or false (0 or 1.) However, if we want to change the Boolean value from true to false later in the program, we can type a= false. This will turn the Boolean value of the variable a to false. Remember that these Boolean values (true or false) should be written directly without any double or single quotes.

Got A Question?

'I love being Prime'

Have a question but don't want to ask it publicly? If you are a prime member just ask right here and we will get back to you within 48 hours. Not prime yet? no worries you can ask publicly below.

Act now while we have available seating

Our on line school is private, affordable and interactive with trainer support.
Act now save your seat before someone else takes yours.
Act now