文字列テンプレートを使用することは推奨されています。以下のようにコードが読みやすくなるためです。
例:
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")
}
}