Black monkey house: Scala interpolator

Scala formatted string is one of three predefined library string interpolator

package com.heihouzi.unit01

/**
  * @author 黑猴子
  */
object FunctionModule {
  def main (args: Array[String] ): Unit = {
    val name = "Tom"
    // Hello Tom
    val vname = s"Hello ${name}"
    // 1+1=2
    val vnumber = s"1 + 1 = ${ 1 + 1}"
    println(vname)
    println(vnumber)
  }
}

Reproduced in: https: //www.jianshu.com/p/a2c2b7dd4965

Guess you like

Origin blog.csdn.net/weixin_34319374/article/details/91182420