Hello,
When using a function parameter or argument, how do you reference it within the body of the function when trying to print the argument in a character string?
Hello,
When using a function parameter or argument, how do you reference it within the body of the function when trying to print the argument in a character string?
println("Step 1: How to define function with parameters")
def calculateDonutCost(donutName: String, quantity: Int): Double = {
println(s"Calculating cost for $donutName, quantity = $quantity")
// make some calculations ...
2.50 * quantity
}