add foobar() example to Function/Procedure section showing var parameters
This commit is contained in:
parent
736968ffe2
commit
f616d27fde
|
@ -240,6 +240,10 @@ int bar() {
|
||||||
int baz(int x) {
|
int baz(int x) {
|
||||||
return x*2;
|
return x*2;
|
||||||
}
|
}
|
||||||
|
int foobar(int *x) {
|
||||||
|
return (++*x)*2;
|
||||||
|
}
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -250,8 +254,12 @@ proc foo() =
|
||||||
proc bar(): int =
|
proc bar(): int =
|
||||||
2
|
2
|
||||||
|
|
||||||
proc baz(x: int) =
|
proc baz(x: int): int =
|
||||||
x*2
|
x*2
|
||||||
|
|
||||||
|
proc foobar(x: var int): int =
|
||||||
|
inc(x)
|
||||||
|
result = x*2 # also valid
|
||||||
</pre>
|
</pre>
|
||||||
</td>
|
</td>
|
||||||
<td><b>Function/Procedure.</b> </td>
|
<td><b>Function/Procedure.</b> </td>
|
||||||
|
|
Loading…
Reference in New Issue