August 2017
Intermediate to advanced
440 pages
10h
English
Characters in Kotlin are stored in type Char. In many ways, characters are similar to strings, so we will concentrate on the similarities and differences. To define Char, we must use single quote, as opposed to a String where we are using double quotes:
val char = 'a' // 1
val string = "a" // 2
In both characters and strings, special characters can be escaped using a backslash. The following escape sequences are supported:
Let's define a Char containing the Yin Yang Unicode character (U+262F):
var yinYang = '\u262F' ...
Read now
Unlock full access