Content
@
0 reply
0 recast
0 reaction
Agost Biro
@agostbiro
Let’s try a more difficult one with closures. What’s wrong with this closure let closure = |x: &str| x;
6 replies
0 recast
4 reactions
grayman
@grayman
Isn't "let closure = x;" doing the same thing as "let closure = |x: &str| x;"?
1 reply
0 recast
1 reaction
Agost Biro
@agostbiro
Good question, but no, the former assigns the value of x to the variable named closure (whatever x is), while the latter assign the specific closure to the variable where x is an input parameter. In fact you could remove the “let closure =“ part and the problem would persist I just wanted to make it easier to read
0 reply
0 recast
0 reaction