RosettaCodeData/Task/Add-a-variable-to-a-class-instance-at-runtime/Red/add-a-variable-to-a-class-instance-at-runtime.red
2016-12-05 23:44:36 +01:00

11 lines
310 B
Text

person: make object! [
name: none
age: none
]
people: reduce [make person [name: "fred" age: 20] make person [name: "paul" age: 21]]
people/1: make people/1 [skill: "fishing"]
foreach person people [
print reduce [person/age "year old" person/name "is good at" any [select person 'skill "nothing"]]
]