Description
Hi,
it's just caught my eye, that closures from this example don't really explain what a capture means.
rust-by-example/src/fn/closures.md
Lines 29 to 30 in 767a6bd
As a totally new to rust I've got an impression that closures in rust capture the whole outer scope disregards of where the closure is defined in code, e.g., before or after the captured variable.
Upd. and then I realised that, probably, this example should never be read as "an example of capturing". What confused me is the beginning explaining what a closure is, giving its probably the most important characteristic first.
Still I would add a capture example here, otherwise it seems just like another way of defining a function (which is probably true as well), with even more confusing variable i
having the same name as a function/closure argument i
.
Best regards,
Mikhail