object Demo { def main(args : Array[String]) { // println println("Age: "+39); println("Name: %10s, Age: %10d".format("Lin", 39)); // printf printf("Name: %10s, Age: %10d\n", "Lin", 39); } }
object Demo { def main(args : Array[String]) { val name = "Lin"; // 's' Interpolator println(s"Hello $name"); println(s"1 + 1 = ${1+1}"); // 'f' Interpolator println(f"Hello $name%10s"); // ‘raw’ Interpolator println(raw"Hello \n $name"); // no escape } }