String Interpolation pt2

As mentioned here, Scala comes with string interpolation –

println(s"You are $age years old")


println("You are " + age + " years old")

This functionality also stretches beyond strings. You can also perform c-style printf substitutions. Here’s an example from the official scala documentation:

val height = 1.9d
val name = "James"
println(f"$name%s is $height%2.2f meters tall")  
// James is 1.90 meters tall