diff --git a/ch03-03-functions.html b/ch03-03-functions.html index 5fc35d7a2..3fede068a 100644 --- a/ch03-03-functions.html +++ b/ch03-03-functions.html @@ -139,7 +139,7 @@ fn another_function(x: i32) { type. This is a deliberate decision; we find that requiring type annotations in functions means that you almost never need them anywhere else.
You can separate multiple arguments with a comma:
-fn NAME(PATTERN, PATTERN, PATTERN, PATTERN...) {
+fn NAME(PATTERN: TYPE, PATTERN: TYPE, PATTERN: TYPE, PATTERN: TYPE...) {
Here’s a full example:
fn main() {
@@ -184,7 +184,7 @@ only its parameters are in scope, so we need to use those names. Bindings
passed as parameters don’t need to have the same name as the arguments.
Return values
Functions can also return values back to the function that called them:
-fn NAME(PATTERN, PATTERN, PATTERN, PATTERN...) -> TYPE {
+fn NAME(PATTERN: TYPE, PATTERN: TYPE, PATTERN: TYPE, PATTERN: TYPE...) -> TYPE {
We don’t name return values, but we do declare their type, after an arrow:
->. Here’s a sample program:
diff --git a/print.html b/print.html
index 7a7e8e8b3..4588bc8d7 100644
--- a/print.html
+++ b/print.html
@@ -966,7 +966,7 @@ fn another_function(x: i32) {
type. This is a deliberate decision; we find that requiring type annotations in
functions means that you almost never need them anywhere else.
You can separate multiple arguments with a comma:
-fn NAME(PATTERN, PATTERN, PATTERN, PATTERN...) {
+fn NAME(PATTERN: TYPE, PATTERN: TYPE, PATTERN: TYPE, PATTERN: TYPE...) {
Here’s a full example:
fn main() {
@@ -1011,7 +1011,7 @@ only its parameters are in scope, so we need to use those names. Bindings
passed as parameters don’t need to have the same name as the arguments.
Return values
Functions can also return values back to the function that called them:
-fn NAME(PATTERN, PATTERN, PATTERN, PATTERN...) -> TYPE {
+fn NAME(PATTERN: TYPE, PATTERN: TYPE, PATTERN: TYPE, PATTERN: TYPE...) -> TYPE {
We don’t name return values, but we do declare their type, after an arrow:
->. Here’s a sample program: