Skip to content

Commit f6b6f27

Browse files
authored
修改用词
把passing paremeter换成了argument;sentence换成了statement
1 parent 2073dc6 commit f6b6f27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/en/quickstart/04function/01define-and-call.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func functionName(parameter1, parameter2, ...) -> returnType{
1616
}
1717
```
1818

19-
`func` is the key word of function `functionName` is the identifier or name of the function, the following `parameter1, parameter2, ...` is the parameter list of the function,`returnType`is optional, which is the returned type of the function. Function body is a series of sentences surrounded by `{}`. Here’s a example below:
19+
`func` is the key word of function `functionName` is the identifier or name of the function, the following `parameter1, parameter2, ...` is the parameter list of the function,`returnType`is optional, which is the returned type of the function. Function body is a series of statements surrounded by `{}`. Here’s a example below:
2020

2121
```mcfpp
2222
func add(int a, int b) -> int{
@@ -30,7 +30,7 @@ The name of the function is `add`, it have two integer-type parameters `a` and `
3030

3131
`return` is same as the `return` command in Minecraft, both used to return the returned value of the function. It’s grammar is `return expression;`, `expression` is an expression, it’s value is the returned value of the function.
3232

33-
If a function defined the type of the returned value, then each branch of it must have `return` sentence, so the function must would return a value. And the value that `return` sentence returned must have the same type as the type of return value of the function, or the subtype of the returned value’s type.
33+
If a function defined the type of the returned value, then each branch of it must have `return` statement, so the function must would return a value. And the value that `return` statement returned must have the same type as the type of return value of the function, or the subtype of the returned value’s type.
3434

3535
If a function haven’t defined the return value’s type, then the default is `void`, which won’t return any value. Now, `return` statement is still available, but its grammar becomes `return;`, without any expression. Its function is stop the function immediately.
3636

@@ -47,7 +47,7 @@ func test(){
4747

4848
In this example, `test` function called `add` function, and sent two parameters `1` and `2`. `add` function returns `3`, so the `test` function will print `3`.
4949

50-
## The parameter passing of function
50+
## The argument of function
5151

5252
In the function, the change to the parameter won’t affect the variables out of the function. For example:
5353

@@ -63,4 +63,4 @@ void main(){
6363
}
6464
```
6565

66-
In this case, `test` function modified the passing parameter `a`, but the `a` in `main` function haven’t been affected.
66+
In this case, `test` function modified the passed in parameter `a`, but the `a` in `main` function haven’t been affected.

0 commit comments

Comments
 (0)