Multiple conditions in guard statement swift -
is there way include multiple conditions in guard statement of swift? example if want check 2 optionals values nil using guard how should using single guard statement?
//check code
func demo(){ var str = [string: string]() str["status"] = "blue" str["asd"] = nil guard let var2 = str["asd"],let var1 = str["status"] else { print("asdsfddffgdfgdfga") return } print("asdasdasd") }
//// guard check 1 one condition. if first true check next otherwise executes else part
Comments
Post a Comment