On Thu, Jun 23, 2016 at 8:36 AM, James Campbell via swift-evolution
<[email protected]> wrote:
> I was wondering if people would be open to adding an unwrap method to the
> Optional type,  I already have a method like this which shortens code for
> me.
>
> So this:
>
> let myReallyLongOptionalName: String? = "Hey"
>
> if let string = myReallyLongOptionalName {
>   doSomethingWith(string)
> }
>
> Could become"
>
> let myReallyLongOptionalName: String? = "Hey"
>
> myReallyLongOptionalName.unwrap {
>   doSomethingWith($0)
> }

We have that, it is called '.map'.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to