tics of the `defer`
> statement, and I don't see any advantage. Sorry.
>
> -Michael
>
>> Am 06.06.2016 um 22:14 schrieb donny wals via swift-evolution
>> <swift-evolution@swift.org>:
>>
>> Michael,
>>
>> How would this proposal break your snip
ditions have been met.:
>
> guard something
> guard something
> allocate memory; defer {release memory}
>
> -- E
>
>
>
>> On Jun 6, 2016, at 1:50 PM, donny wals via swift-evolution
>> <swift-evolution@swift.org> wrote:
>>
>> Hi,
>&
s its purpose. And simple functions like fibonacci I would just write
> without using `defer` at all - it's just confusing to use `defer` and `inout`
> in this case IMO.
>
> /// Calculates the n'th fibonacci number. (n >= 1)
> func fibonacci(n: Int) -> Int {
>var a =
Hi,
When we’re using defer we write some code that we want to execute the moment a
scope exits.
This leads to code that could read like:
let fibonacci = sequence(state: (0, 1)) { (pair: inout (Int, Int)) -> Int in
defer { pair = (pair.1, pair.0 + pair.1) }
return pair.0
}
What I find