Function bodies contain statements and expressions.
; can turn an expression into a statement. So is a function definition itself a statement or an expression? It doesn't have a semicolon on it.
If we look at the function reference we can see the syntax laid out as such:
The way this reads is that a
Function is the following, in order:
somethingin our example above
( FunctionParameters? )(sometimes also called arguments)
a: i32is our only parameter
The final piece is a
BlockExpression. So a function is some stuff followed by a block expression.
That doesn't fully answer our question though. Let's take a look at the definition of syntax for
Statement is any one of these things. In our case, we only care about
Item (whose syntax is a bit more complicated). A
Function declaration, it turns out, is an
In the end a
Function is an
Item which is a
Statement, so functions are statements and thus don't need
; on the end of a function declaration.