Updated Nim for Python Programmers (markdown)

This commit is contained in:
Federico Ceratto 2015-04-11 16:42:39 +01:00
parent 6c15143548
commit fb065f5088
1 changed files with 9 additions and 2 deletions

View File

@ -106,7 +106,7 @@ var c = Cat(name: "Tom")
c.increase_age()
echo c.name, " ", c.age
```
Tip: use objects by reference
### Inheritance
@ -130,7 +130,14 @@ So, when using inheritance, be sure to inherit using refs, unless you know what
### Python tuples
Nim Tuples are close to Python nametuples, see [manual](http://nim-lang.org/manual.html#tuples-and-object-types)
Nim Tuples are close to Python nametuples, see [manual](http://nim-lang.org/manual.html#tuples-and-object-types).
Use Nim arrays:
``` Nim
var a = ["hi", "there"]
var b = [1, 2, 3]
echo b[1]
var c = ["hi", 1] # no mixed types please
```
### Python sets