Fixed links and language indentifier in a code block.
This commit is contained in:
parent
1817383ce5
commit
d4f1cc8ee8
|
@ -58,7 +58,7 @@ In Nim, arrays are much more strict. They are pass-by-value (meaning they're cop
|
||||||
|
|
||||||
**Nim:**
|
**Nim:**
|
||||||
|
|
||||||
```Nimrod
|
``` Nim
|
||||||
proc foobar(z: array[0..3, int]) =
|
proc foobar(z: array[0..3, int]) =
|
||||||
z[5] = 5 # Error: Cannot assign to z
|
z[5] = 5 # Error: Cannot assign to z
|
||||||
echo z[5] # Error: Index out of bounds.
|
echo z[5] # Error: Index out of bounds.
|
||||||
|
@ -90,7 +90,7 @@ It is possible to implement object-orientation features through libraries, thank
|
||||||
|
|
||||||
Python-like object orientation example:
|
Python-like object orientation example:
|
||||||
|
|
||||||
```Nim
|
``` Nim
|
||||||
type Animal = ref object of RootObj
|
type Animal = ref object of RootObj
|
||||||
age: int
|
age: int
|
||||||
name: string
|
name: string
|
||||||
|
@ -153,7 +153,7 @@ echo a[0..1] # returns "he": ranges are inclusive! See the "Ranges" paragraph
|
||||||
|
|
||||||
### Python tuples
|
### Python tuples
|
||||||
|
|
||||||
Nim Tuples are close to Python nametuples, see [manual](http://nim-lang.org/docs/manual.html#tuples-and-object-types).
|
Nim Tuples are close to Python nametuples, see [manual](http://nim-lang.org/docs/manual.html#types-tuples-and-object-types).
|
||||||
Use Nim arrays:
|
Use Nim arrays:
|
||||||
``` Nim
|
``` Nim
|
||||||
var a = ["hi", "there"]
|
var a = ["hi", "there"]
|
||||||
|
@ -164,7 +164,7 @@ var c = ["hi", 1] # no mixed types please
|
||||||
|
|
||||||
### Python lists
|
### Python lists
|
||||||
|
|
||||||
Use [Nim sequences](http://nim-lang.org/docs/tut1.html#sequences)
|
Use [Nim sequences](http://nim-lang.org/docs/tut1.html#advanced-types-sequences)
|
||||||
|
|
||||||
Nim arrays and sequences can hold only items of the same type.
|
Nim arrays and sequences can hold only items of the same type.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue