How to use an expression inside a string in Kotlin

1 Answer

0 votes
fun main() {
    val number = 14
	val result = "The double of ${number} is: ${number * 2}"
	
    println(result) 

}

 
  
/*
run:
  
The double of 14 is: 28

*/

 



answered Jun 17, 2025 by avibootz
...