Simple functions
In Rust we can create multiple functions apart from the main one. Here is a little example of how to do it:
|
|
Rust code uses snake case as the conventional style. This means all lowercase and underscore separated words.
Parameterized functions
Functions can have parameters. Parameters or arguments are variables that are only in the scope of the function code. This means it cannot be accessed anywhere outside the function block. The arguments values are provided by the script.
|
|
When we use arguments, we must specify the argument data type.