When I create a function in Julia, I print something in the function and don't return anything. But the result is the function print what I want and also return 'nothing'. What can I do to make the function just print what I want without return 'nothing'?
There is always a return value from a function. When there is no explicit return statement, the value of the last expression in the function is returned. This is probably what you're seeing here: if the print statement is the last line of your function, since print's return value is nothing, that becomes the return value of your function too.
If you just don't want the nothing shown at the end of the output,then please paste the code you're using that leads to this behaviour, and we can figure out how to suppress this output of nothing from appearing.
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