mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-26 07:03:57 +00:00
[nim/en] Fixed instantiation of the reference object (#5234)
This commit is contained in:
parent
0dba59d585
commit
ca117e4079
7
nim.md
7
nim.md
@ -129,8 +129,11 @@ type
|
||||
|
||||
var
|
||||
defaultHouse = House() # initialize with default values
|
||||
defaultRoom = new Room() # create new instance of ref object
|
||||
sesameHouse = House(address: "123 Sesame St.", rooms: @[defaultRoom])
|
||||
defaultRoom = Room() # create new instance of ref object with default values
|
||||
|
||||
# Create and initialize instances with given values
|
||||
sesameRoom = Room(windows: 4, doors: 2)
|
||||
sesameHouse = House(address: "123 Sesame St.", rooms: @[sesameRoom])
|
||||
|
||||
# Enumerations allow a type to have one of a limited number of values
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user