> > Did you mean “implicitly unwrapped”? Then, by the above logic, the type of > the ‘if’ expression is Bool, so it would crash if ‘bbb’ is nil. Otherwise, it > would test the boolean value of ‘bbb’.
Turns out, after a try in a playground, that this is the right way to do it: var b : Bool! = nil var ans : String? if b { if b! { ans = "True" } else { ans = "False" } } else { ans = "Nil" } The first test sifts nil from everything else, and the second one 'true' from 'false'. Vincent _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com