[swift-evolution] Proposal: for loops with return values

Félix Cloutier felixcca at yahoo.ca
Thu Jan 14 14:35:23 CST 2016


This has been proposed before and Chris said that it would be out of scope for Swift 3. There is definitely interest in this area though.

Félix

> Le 14 janv. 2016 à 15:30:07, Amir Michail via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> These would be like the unrolled versions of Python’s generator expressions.
> 
> Examples:
> 
> let a:[Int] = for x in l { yield x*2 }
> 
> let b:[(Int,Int)] = for row in 0..<m { for col in 0..<n { yield (row,col) } }
> 
> let c:[(Int,Int)] = for row in 0..<m { for col in 0..<n where row+col < 5 { yield (row,col) } }
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160114/b25cbfe1/attachment.html>


More information about the swift-evolution mailing list