[swift-users] Can anyone please explain this behavior?

Jens Persson jens at bitcycle.com
Wed Sep 21 16:22:32 CDT 2016


// 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`"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160921/aa148727/attachment.html>


More information about the swift-users mailing list