l3x / learn-fp-go

Learning Functional Programming in Go
97 stars 53 forks source link

Ineffective assignment in 06_curry/main.go #14

Open brackendawson opened 3 years ago

brackendawson commented 3 years ago

https://github.com/l3x/learn-fp-go/blob/7639825d0b71633420ba17a10abb5c69491ba517/1-functional-fundamentals/ch01-pure-fp/06_curry/main.go#L5

This assignment of n to ret by the return statement is ineffective and confusing, the assignment in the deferred function will overwrite it. This line should simply be return with no arguments.