> On Sep 21, 2016, at 2:22 PM, Jens Persson via swift-users
> <[email protected]> wrote:
>
> // This little Swift program compiles (and runs) fine:
>
> func foo() -> Int { return a }
> let a = 1
> let b = 2
> print(foo())
>
> But if `foo()` returns `b` instead of `a`, I get this compile time error:
> "Use of unresolved identifier `b`”
Interesting. Seems to have something to do with ordering as if you code it
this way:
let a = 1
let b = 2
func foo() -> Int { return b }
print(foo())
it works fine (Xcode 8 playground).
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users