> 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/c/classes.md).

# Classes

```ruby
class MyClass(instance_var) {
    method add(num) {
        instance_var += num
    }
}
 
var obj = MyClass(3)    # `instance_var` will be set to 3
obj.add(5)              # calls the add() method
say obj.instance_var    # prints the value of `instance_var`: 8
```
