From f616d27fde443f07bc5d4f5129d30e6c72e37fde Mon Sep 17 00:00:00 2001 From: jlp765 Date: Mon, 5 Sep 2016 20:49:36 +1000 Subject: [PATCH] add foobar() example to Function/Procedure section showing var parameters --- Nim-for-C-programmers.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Nim-for-C-programmers.md b/Nim-for-C-programmers.md index 10380c5..4954b61 100644 --- a/Nim-for-C-programmers.md +++ b/Nim-for-C-programmers.md @@ -240,6 +240,10 @@ int bar() { int baz(int x) { return x*2; } +int foobar(int *x) { + return (++*x)*2; +} + @@ -250,8 +254,12 @@ proc foo() = proc bar(): int = 2 -proc baz(x: int) = +proc baz(x: int): int = x*2 + +proc foobar(x: var int): int = + inc(x) + result = x*2 # also valid Function/Procedure.