README for this exercise.
A Community Resource means that it’s free to access for all. The instructor of this lesson requested it to be open to the public.
Chris Biscardi: In functions5, we have our main() function with an answer set to this value of square (3). We use another println! Macro to print out our answer. The square() function takes a number parameter that's an i32 and returns an i32. All we're doing here is squaring the number.
The Rust error tells us there's mismatched types, specifically in the square() function that we just took a look at. It points to the return value of i32 where it expected an i32 and found two parentheses. These two parentheses are usually pronounced unit, U-N-I-T. A unit type is basically nothing.
What Rust is telling us here is that this function implicitly returns nothing as its body, as its body has no tail or return expression. We have a little bit of help text here that says, "Consider removing this semicolon." Let's try that.
Note that this works because the implicit return requires you to not use a semicolon at the end. If we were going to use a semicolon, we could also use an explicit return, and that would work.