October 2018
Intermediate to advanced
370 pages
9h 15m
English
The character data type is one of the data types available in Kotlin. This can contain 2 bytes of information and it can also store pretty much all the characters that you see on your keyboard. The syntax is the same as any other declaration—the word Char is used to declare a character variable and the value on the right-hand side must be enclosed by single quotes:
var mychar : Char = 'A'
Let's take a look at some examples. When character values are assigned to the Char data type, this can be displayed as follows:
var charA : Char = 'A'var charZ : Char = 'Z'var char1 = '1'var char0 = '0'
Each character has a unique Unicode for its representation, and the character data type can be stored in Unicode values. Let's display ...
Read now
Unlock full access