func greet (person:[String: String]){
guard let name = person["name"] else{
return
}
if let name = person["name"] {
print(name)
}else{
return
}
print("hello \(name)!")
guard let location = person["location"] else {
print("I hope the weather is nice near you .")
return
}
print("I hope the weather is nice in \(location)")
}
//greet(person: ["name":"ryan"])
greet(person: ["location":"ChongQing"])
//greet(person: ["name":"ryan","location":"Cupertion"])
网友评论