thp-web/md/learn/classes/magic.md

26 lines
263 B
Markdown

# Magic methods
Don't get special treatment.
```thp
class Cat
{
pub fun __sleep() -> Array[String]
{
// logic
}
}
```
```thp
let option = Some("GAAA")
let Some(value) = option
let colors = Array("red", "green", "blue")
let Array()
```