In the style guide it says that functions that modify their arguments should be marked with a !
. However in the example given the function double!
returns the modified argument a
. Why return it if it has already been modified? Is it necessary?
It doesn't cost anything and enables you do things like:
b = double!(a)*x
or
double!(double!(a))
in a single line if you needed to.
For that reason (i.e. convenience), it has become convention.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With