Updated Nimrod for C programmers (markdown)
This commit is contained in:
parent
f2c74b90e3
commit
a805bedc8a
|
@ -84,6 +84,36 @@ var x = if foobar(): 42 else: 0
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
```C
|
||||||
|
void foo() {
|
||||||
|
printf("Hello World\n");
|
||||||
|
}
|
||||||
|
int bar() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
int baz(int x) {
|
||||||
|
return x*2;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
```Nimrod
|
||||||
|
proc foo() =
|
||||||
|
echo "Hello World"
|
||||||
|
|
||||||
|
proc bar() : int =
|
||||||
|
2
|
||||||
|
|
||||||
|
proc baz(x : int) =
|
||||||
|
x*2
|
||||||
|
```
|
||||||
|
</td>
|
||||||
|
<td><b>Function/Procedure.</b> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
```C
|
```C
|
||||||
|
@ -106,4 +136,6 @@ proc foobar(a: ref TPerson) =
|
||||||
</td>
|
</td>
|
||||||
<td><b>Dereference.</b> <i>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.</i> </td>
|
<td><b>Dereference.</b> <i>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.</i> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
Loading…
Reference in New Issue