DEV Community

loading...

Discussion on: Mere Functional Programming in F#

Collapse
rhymes profile image
rhymes • Edited

And in fact, a function can use mutation and still be deterministic as long as the mutations are local.

Yes, though it's not always the case in reality, many for loops have side effect in imperative programs :D

An interesting example of an improvement: Go loop variables are scoped within the loop, you can't access them from outside the loop.

Thread Thread
kspeakman profile image
Kasey Speakman Author • Edited

For sure, it is otherwise normal to perform external side effects in for loops. Just to say that with some discipline it can be avoided. Though I think that way of doing things is pretty foreign to most of us.