Adding inline explicit type annotations to a closure with a return value but no input parameters in Swift?

后端 未结 0 1107
清酒与你
清酒与你 2020-12-12 03:28

Normally a function doesn\'t need explicit types since it can infer the type from the context:

let f = { input in
  1 + input
}
f(2)

Oftentim

相关标签:
回答
  • 消灭零回复
提交回复
热议问题