thp-lang.org/md/learn/classes/magic.md

26 lines
263 B
Markdown
Raw Normal View History

2023-10-05 12:56:34 +00:00
# Magic methods
2023-10-24 01:39:34 +00:00
Don't get special treatment.
2023-10-05 12:56:34 +00:00
```thp
class Cat
{
pub fun __sleep() -> Array[String]
{
// logic
}
}
```
2023-10-24 01:39:34 +00:00
```thp
let option = Some("GAAA")
let Some(value) = option
2023-10-26 01:51:20 +00:00
let colors = Array("red", "green", "blue")
let Array()
2023-10-24 01:39:34 +00:00
```