Call a method by naming the parameters.

Named Arguments

NamedArguments.scala
object Main {
  def totalCost(price: Int, quantity: Int): Int = {
    price * quantity
  }

  def main(args: Array[String]): Unit = {
    val price = 
    val quantity = 2
    val total = totalCost(quantity = quantity, price = price)

    println("price=" + price)
    println("quantity=" + quantity)
    println("total=" + total)
  }
}
object Main {
  def totalCost(price: Int, quantity: Int): Int = {
    price * quantity
  }

  def main(args: Array[String]): Unit = {
    val price = 
    val quantity = 2
    val total = totalCost(quantity = quantity, price = price)

    println("price=" + price)
    println("quantity=" + quantity)
    println("total=" + total)
  }
}
object Main {
  def totalCost(price: Int, quantity: Int): Int = {
    price * quantity
  }

  def main(args: Array[String]): Unit = {
    val price = 
    val quantity = 2
    val total = totalCost(quantity = quantity, price = price)

    println("price=" + price)
    println("quantity=" + quantity)
    println("total=" + total)
  }
}
named-arguments Named arguments make a call read like a small label-value list.