January 2018
Intermediate to advanced
434 pages
14h 1m
English
In the following steps, we will learn how to use String templates:
$variableName
Alternatively, it is this:
${expression}
fun main(args: Array<String>) { val foo = 5; val myString = "foo = $foo" println(myString) }
The output of the preceding code will be foo = 5.
fun main(arr: Array<String>){ val lang = "Kotlin" val str = "The word Kotlin has ${lang.length} characters." println(str)}
Read now
Unlock full access