Fix bad code
This commit is contained in:
parent
382641aed8
commit
b4c5e06295
3 changed files with 36 additions and 21 deletions
|
|
@ -26,7 +26,7 @@ let joe = Animal(name : "Joe",
|
|||
species : "H. sapiens",
|
||||
age : 23)
|
||||
|
||||
assert not carl.dead
|
||||
assert(not carl.dead)
|
||||
for i in 0..10:
|
||||
carl.sleep()
|
||||
assert carl.dead
|
||||
|
|
@ -54,9 +54,9 @@ You might ask whether there is a more concise way of initializing reference typ
|
|||
|
||||
``` nimrod
|
||||
type
|
||||
PAnimal* = ref Animal
|
||||
AnimalRef* = ref Animal
|
||||
|
||||
let spot = PAnimal(name: "Spot",
|
||||
let spot = AnimalRef(name: "Spot",
|
||||
species: "C. lupus",
|
||||
age: 1)
|
||||
```
|
||||
|
|
@ -67,4 +67,4 @@ In many cases it is only wanted to have the object be a reference type, which is
|
|||
type
|
||||
Thing* = ref object
|
||||
positionX*, positionY*: int
|
||||
```
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue