The general pattern is:

```
fn my_function(first_argument: TypeOfFirstArg, second_argument: TypeOfSecondArg) -> ReturnType {
// ...
}
```

where the number of arguments can be 0, 1, 2, 3, etc. (the pattern above is for two arguments).

For example a function that adds two integers (one of the integer types in Rust is `i32`

):

```
fn add_two_integers(x: i32, y: i32) -> i32 {
x + y
}
```

This function is the same as the following

```
fn add_two_integers(my_first_integer: i32, my_second_integer: i32) -> i32 {
my_first_integer + my_second_integer
}
```

where `x`

and `y`

are renamed. In the parameter list, the names are *declared*, which means you can choose whatever names you like for your arguments. In the function body (inside `{ }`

) you then have to use those names you chose. Your `calculate_length`

function could thus equivalently be written as

```
fn calculate_length(my_string_slice: &str) -> usize {
my_string_slice.len()
}
```

The `s`

has no special meaning, it is just an identifier. The `s: &str`

means “`s`

is an argument of type `&str`

” and `s.len()`

means “call the method called `len`

on `s`

”.

In my version of `calculate_length`

, correspondingly, the `my_string_slice: &str`

means “`my_string_slice`

is an argument of type `&str`

” and `my_string_slice.len()`

means “call the method called `len`

on `my_string_slice`

”.

Finally, the fact that the `s.len()`

expression is the final (and only) expression in the `calculate_length`

function (and does not have any `;`

behind it) means that the result of the method call to `len`

is the value that’s returned from the `calculate_length`

function.

Similarly the `x + y`

in the `add_two_integers`

example above is also returned, which means that the sum of `x`

and `y`

will be the return value of the `add_two_integers`

function.