> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/a/add_a_variable_to_a_class_instance_at_runtime.md).

# Add a variable to a class instance at runtime

```ruby
class Empty{};
var e = Empty();    # create a new class instance
e{:foo} = 42;       # add variable 'foo'
say e{:foo};        # print the value of 'foo'
```
