[nim/en] Fixed instantiation of the reference object (#5234)

This commit is contained in:
cd-n0 2025-02-03 15:12:42 +00:00 committed by GitHub
parent 0dba59d585
commit ca117e4079
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

7
nim.md
View File

@ -129,8 +129,11 @@ type
var var
defaultHouse = House() # initialize with default values defaultHouse = House() # initialize with default values
defaultRoom = new Room() # create new instance of ref object defaultRoom = Room() # create new instance of ref object with default values
sesameHouse = House(address: "123 Sesame St.", rooms: @[defaultRoom])
# 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 # Enumerations allow a type to have one of a limited number of values