Move Out!

We moved the Fruit value into the count_fruit function. Let’s move it back out by using a return type! Up until now, we’ve implicitly been returning a () unit value. Instead, let’s return the Fruit value itself.

Exercise

Modify the count_fruit function so that it returns the same Fruit value it received as a parameter.

With that modified count_fruit function in place, we can do a really awkward dance in the main function.

Get hands-on with 1400+ tech skills courses.