Re: [swift-users] optional variable with ternary operator

2017-05-08 Thread Saagar Jha via swift-users
This functionality was removed via SE-0121, back in the Swift 3 timeframe. Saagar Jha > On May 8, 2017, at 19:49, Zhao Xin wrote: > > I wonder if it has ever been allowed? I am using Xcode and it never allows > that. > For you specific question, you can use > > var

Re: [swift-users] optional variable with ternary operator

2017-05-08 Thread Zhao Xin via swift-users
I wonder if it has ever been allowed? I am using Xcode and it never allows that. For you specific question, you can use var number:Int? let result = (number ?? -1) > 0 ? 1 : 2 Zhaoxin On Tue, May 9, 2017 at 1:39 AM, Erica Sadun via swift-users < swift-users@swift.org> wrote: > I believe this