Functions
The fn
keyword is used to define new functions.
The double
and multiply
functions are defined
without the pub
keyword. This makes them private
functions, they can only be used within this module. If another module
attempted to use them it would result in a compiler error.
Like with assignments, type annotations are optional for function arguments and return values. It is considered good practice to use type annotations for functions, for clarity and to encourage intentional and thoughtful design.