From a805bedc8ad7484405a0b23e1a664b1aff61574c Mon Sep 17 00:00:00 2001 From: Audun Wilhelmsen Date: Fri, 20 Dec 2013 02:16:18 -0800 Subject: [PATCH] Updated Nimrod for C programmers (markdown) --- Nimrod-for-C-programmers.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Nimrod-for-C-programmers.md b/Nimrod-for-C-programmers.md index f44b894..8971488 100644 --- a/Nimrod-for-C-programmers.md +++ b/Nimrod-for-C-programmers.md @@ -84,6 +84,36 @@ var x = if foobar(): 42 else: 0 + + + +```C +void foo() { + printf("Hello World\n"); +} +int bar() { + return 2; +} +int baz(int x) { + return x*2; +} +``` + + +```Nimrod +proc foo() = + echo "Hello World" + +proc bar() : int = + 2 + +proc baz(x : int) = + x*2 +``` + +Function/Procedure. + + ```C @@ -106,4 +136,6 @@ proc foobar(a: ref TPerson) = Dereference. In C, only the pointer to the strings in the struct is copied. In Nimrod, the string is also copied, but refs are not deep-copied. + + \ No newline at end of file