Scala - Using String interpolation for formatting text Code Example

The code for Using String interpolation for formatting text

println("Using String interpolation for formatting text")

val name: String = "Alvin Alexander"
val age: Int = 38
println(f"$name%20s $age")

/*
Output:
Using String interpolation for formatting text
     Alvin Alexander 38
*/
Code by IncludeHelp, on August 8, 2022 03:17

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.