Mohammad Fallah
09/01/2025, 12:43 PMfun rollDice(): 1 | 2 | 3 | 4 | 5 | 6 {...}
or
fun switch(switch : "on" | "off") { ... }
jw
09/01/2025, 1:07 PMMohammad Fallah
09/01/2025, 1:24 PMtypealias
to make them reusable and readable)mikhail.zarechenskiy
09/01/2025, 1:27 PMMohammad Fallah
09/01/2025, 1:45 PMval a : 5 = 5
or
val b : "on" = "on"
So we can combines literal types like 1 | 2
or "on" | "off"
I know that it is possible with enums, sealed class and value classes with private constructor but creating those just for a private function feels like overkill. 😅