thp-web/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
2023-10-26 01:51:20 +00:00
val option = Some("GAAA")
val Some(value) = option
val colors = Array("red", "green", "blue")
val Array()
2023-10-24 01:39:34 +00:00
```