You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/return.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,15 +7,15 @@
7
7
- In PawnScript, to return a value it means to execute the code and give the result output, after returning a value, code block execution will stop.
8
8
9
9
```cpp
10
-
intMyForm() public;
10
+
intMyForm() public
11
11
{
12
-
console.println("Hello World");
13
-
return,1;
14
-
console.println("This code won't be executed");
12
+
console.println("Hello World")
13
+
return 1
14
+
console.println("This code won't be executed")
15
15
}
16
16
17
-
console.cout(MyForm);
18
-
system.rem("Thing above will print 1");
17
+
console.cout(MyForm)
18
+
system.rem("Thing above will print 1")
19
19
```
20
20
21
21
@@ -24,15 +24,15 @@ system.rem("Thing above will print 1");
24
24
-`yield` return will do the same thing as a normal return, the difference is that the code block won't stop being executed until `};` or `return..,..;`.
25
25
26
26
```cpp
27
-
intMyForm() public;
27
+
intMyForm() public
28
28
{
29
-
console.println("Hello World");
30
-
yield&return,1;
31
-
console.println("This code will be executed too");
29
+
console.println("Hello World")
30
+
yield&return,1
31
+
console.println("This code will be executed too")
32
32
}
33
33
34
34
console.cout(MyForm);
35
-
system.rem("Thing above will print 1");
35
+
system.rem("Thing above will print 1")
36
36
```
37
37
38
38
@@ -43,16 +43,16 @@ system.rem("Thing above will print 1");
43
43
Little example:
44
44
45
45
```cpp
46
-
intTestFunction() public;
46
+
intTestFunction() public
47
47
{
48
-
return.bool,false;
48
+
returnboolfalse
49
49
}
50
50
```
51
51
52
52
- Return type assigned to a function `TestFunction` is integer, but we returned a boolean. If we do not want to return any value, we just assign the `void` return type:
53
53
54
54
```cpp
55
-
voidTestFunction() public;
55
+
voidTestFunction() public
56
56
{
57
-
system.rem("Now we can't use a return keyword in this function block.");
57
+
system.rem("Now we can't use a return keyword in this function block.")
0 commit comments