“Sample2” let sampleFunc: (x: Int, y: Int) -> Int = { (x: Int, y: Int) -> Int in return x + y } } ˡؔͷఆٛ let sample2: Sample2 = Sample2() sample2.name sample2.sampleFunc(x: 10, y: 5)
y: Int) -> Int) { var result = { (x: Int, y: Int) -> Int in return x + y } switch type { case 0: result = { (x: Int, y: Int) -> Int in return x - y } case 1: result = { (x: Int, y: Int) -> Int in return x * y } default: break } return result } }