Functions
Wu functions are expressions, but can also be declared using the same notation as struct
. For example we can declare functions like this:
The following is just as valid, but more ugly:
They are the exact same behind the scenes. No difference at all.
Functions return the last expression in their body implicitly(like in Rust) like so:
Why have parentheses if they're empty anyways?
You are still able to use explicit returns:
Of course, as we're dealing with a decent language, higher order functions are a thing:
Now for something vaguely interesting. Splats are basically a catchall parameter, that binds as many arguments you throw at it into an array:
Of course we can type the splats:
Last updated