문자열 템플릿을 사용하는 것이 코드 가독성을 위해 좋습니다.
예:
fun example() {
val capitals = mapOf("France" to "Paris", "Spain" to "Madrid")
for ((country, capital) in capitals) {
print(capital + " is a capital of " + country)
}
}
빠른 수정을 적용한 후:
fun example() {
val capitals = mapOf("France" to "Paris", "Spain" to "Madrid")
for ((country, capital) in capitals) {
print("$capital is a capital of $country")
}
}