func sendRequest(argc1: String, arc2: String, completionHandle: () -> Bool) {
if completionHandle() {
print(argc1, arc2)
}
}
sendRequest(argc1: "5", arc2: "6") { () -> Bool in
return true
}
func sendRequest(argc1: String, arc2: String, completionHandle: @autoclosure () -> Bool) {
if completionHandle() {
print(argc1, arc2)
}
}
sendRequest(argc1: "5", arc2: "6", completionHandle: true)
sendRequest(argc1: "5", arc2: "5", completionHandle: 3 < 5)
let conditio1 = 3 + 6 > 5
let condition2 = 5 + 2 < 3
if conditio1 && condition2 {
print("为真")
}
func logTrue(condition1: () -> Bool, condition2: () -> Bool) {
if condition1() && condition2() {
print("condition1和condition2为真")
}
}
logTrue(condition1: { () -> Bool in //这样写是为了让大家看一下到底是不是我们说的那样
print("执行了condition1")
return 3 + 1 > 10
}) { () -> Bool in
print("执行了condition2")
return 3 + 2 > 20
}