November 2018
Intermediate to advanced
388 pages
9h 5m
English
We can also define multiline string literals without having to use + + for concatenation. Let's create a multiline string in the example 4b_MultilineString.kts:
val name = "Atrium"val message = """This is an example of multiline String $name"""println(message)
The output is as follows:

Observe the indentation in the preceding example. If we don't want to use indentation, we can put | and use the trimMargin() function to trim the margin as follows:
val name = "Atrium"val message = """This is an example of |multiline String $name"""println(message.trimMargin())
The output is as follows:
One more thing that we can ...
Read now
Unlock full access