Booleans

Learn about boolean type with insights on equality, relational operators, and logical operators.

Another basic type is Boolean, which has two possible values: true and false.

Press + to interact
fun main() {
val b1: Boolean = true
println(b1) // true
val b2: Boolean = false
println(b2) // false
}

We use booleans to express yes/no answers, such as:

  • Is the user an admin? ...