RosettaCodeData/Task/Add-a-variable-to-a-class-instance-at-runtime/Falcon/add-a-variable-to-a-class-instance-at-runtime-3.falcon

16 lines
250 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
function sub_func( value )
self['prop'] -= value
return self.prop
end
dict = bless( [
'prop' => 0,
'add' => function ( value )
self.prop += value
return self.prop
end ,
'sub' => sub_func
])
dict[ 'newVar' ] = "I'm Rich In Data"