object Base33 {
/*
* 函数参数的使用
*/
def hello(name:String="小明", age:Int=17, gender:String="女"):Unit = {
println(s"hello, 我是${name}. ${age} 岁, 性别:${gender}")
}
def main(args: Array[String]): Unit = {
hello("小花", 18, "女")
hello("小明", 19, "男")
hello("小花", 18) // 1. 不写性别,默认为女
hello() // 2. 不写所有参数,全部使用默认值
hello(age=18) //
hello(gender="男",name="小李")
}
}