Boolean

The true and false logical truth values are represented by the Boolean type:

var t: Boolean = truevar f: Boolean = false

Boolean values are operated upon by the &&, ||, and ! logical operators:

Operator name

Operator

Description

Operator type

Conjunction

&&

Evaluates to true when two of its operands are true, otherwise evaluates to false.

Binary

Disjunction

||

Evaluates to true when at least one operand is true, otherwise evaluates to false.

Binary

Negation

!

Inverts the value of its Boolean operand.

Unary

Get Kotlin Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.