PartitalFunction
偏函数是{}内没有match的一组case语句,
但是不同的是,他是被包含在花括号里面的没有macth这个单词的一组case语句
//定义方法: 方法名:PartitalFunction[传过来的参数类型,返回的参数类型]
//入参 返回参数类型
def sayHello:PartialFunction[String,String] = {
case "鹅" => "鸟叔"
case "瓜" => "瓜帅"
}
println(sayHello("鹅"))
模式匹配可以通过偏函数来实现