4 ms·
In the past, I've used it in order to ensure the variable has a legitimate value. So, something like this (pseudo code): fn foo(a): a = a |> trim |>
by christophilus 9y ago
In the past, I've used it in order to ensure the variable has a legitimate value. So, something like this (pseudo code):
fn foo(a):
a = a |> trim |> (default "chocolate")
mix a "milk"
Well, in this contrived example, I wouldn't reassign a, just tack on `|> (mix "milk")` but in a complex example where you're reusing `a` in several places, it can make sense and is nicer than having to declare a bunch of variables just to hold the sanitized values of arguments.
- maxxxxx 9y agoLooks like you are using it as a reassignable function argument. Makes sense.