October 2018
Intermediate to advanced
370 pages
9h 15m
English
Boolean is a data type that contains one of two values—true or false. Because of its nature, the Boolean variable requires only one single bit for storing data. This bit can be on or off, true or false, 0 or 1. Let's declare some Boolean variables for further discussion:
var result : Boolean = truevar isEmpty : Boolean = false
In the same way as other variables, the Boolean variable can be declared without type inference:
var value = falsevar result = true
Basically, this data type is used for comparing two values, getting results by setting a Boolean as a checkpoint to verify the results via comparison, and getting an answer by way of true or false. Let's see an example of how this can happen:
fun main(args: Array<String>) ...Read now
Unlock full access