Skip to content

Commit db780ae

Browse files
authored
Merge pull request #6 from yuhan2680/main
Translate 02 and 03 in function folder
2 parents 10f7094 + b98d5d2 commit db780ae

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

docs/en/quickstart/04function/02static-params.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
lastUpdate: true
33
---
44

5-
# static关键字
5+
# static keyword
66

7-
`static`关键字用于声明一个静态参数。静态参数表示,在参数传递的过程中,是传递的参数本身而不是参数的值,因此在函数中对参数的修改会影响外部的变量。例如:
7+
`static` keyword used to define a static parameter. Static parameter represents, during the process of transferring parameter, it’ll transfer parameter itself but not it’s value, so the change of parameter in the function would effect the variable out of the function. For example:
88

99
```mcfpp
1010
func test(static int a){
@@ -14,6 +14,6 @@ func test(static int a){
1414
void main(){
1515
int a = 0;
1616
test(a);
17-
print(a); #输出5
17+
print(a); #output 5
1818
}
1919
```

docs/en/quickstart/04function/03inline-function.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
lastUpdate: true
33
---
44

5-
# 内联函数
5+
# Inline function
66

7-
MCFPP中,可以使用`inline`关键字来声明一个内联函数。编译器会在调用内联函数的地方直接将函数的代码插入,而不是通过函数调用的方式来执行。这样可以减少函数调用的开销,提高程序的运行效率。
7+
In MCFPP, we can use keyword `inline` to declare an inline function. When call this function, compiler will insert the code into the code directly, but not call the function. So it can reduce the cost of calling functions, make the program more efficient.
88

9-
## 内联函数的声明
9+
## Declare of inline function
1010

11-
内联函数的声明语法如下:
11+
The grammar of declare a inline function is:
1212

1313
```mcfpp
1414
inline func functionName(parameter1, parameter2, ...) -> returnType{
15-
#函数体
15+
#Function body
1616
}
1717
```
1818

19-
## 内联函数的调用过程
19+
## Call of inline function
2020

21-
在调用内联函数的地方,编译器会直接将内联函数的代码插入,而不是通过函数调用的方式来执行。例如下面的例子:
21+
In the place of calling inline function, compiler will insert the inline function directly, but not call the function. Such as the example below:
2222

2323
```mcfpp
2424
inline func add(int a, int b) -> int{
@@ -30,7 +30,7 @@ func main(){
3030
}
3131
```
3232

33-
编译的时候,上述代码会相当于:
33+
During compilation, the code is same as:
3434

3535
```mcfpp
3636
func main(){
@@ -41,4 +41,4 @@ func main(){
4141
}
4242
```
4343

44-
这同时意味着,在内联函数中,对变量的修改会影响到函数外部的变量。
44+
This means that, in the inline function, the change to variable will effect the variable out of the function.

0 commit comments

Comments
 (0)