Next freebie in 28 Hours*
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.
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.
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.