3 ms·
Well, F# doesn't allow closures to access local mutable variables, and they don't seem "totally useless". In the case of a for loop, F# seems more intuitive: if
by MichaelGG 16y ago
Well, F# doesn't allow closures to access local mutable variables, and they don't seem "totally useless". In the case of a for loop, F# seems more intuitive: if you loop and generate closures using the loop variable, each closure will get the value at the time its created.
This isn't as straightforward in C#, as there are no immutable local bindings. It's annoying, but given the overall language, is probably the best fit.