Friday, 24 November 2017

Kotlin: Characters

'Char; keyword is used to define single character. Character is enclosed in single quotes.

Ex
var myChar : Char = 'a'

HelloWorld.kt
fun main(args: Array<String>) {

 var myChar : Char = 'a'

 println("Value of myChar is : ${myChar}")
}

Output
Value of myChar is : a


All the escape sequences that are supported by Java are also supported by Kotlin.
Previous                                                 Next                                                 Home

No comments:

Post a Comment