Use dot notation for enum variants

This commit is contained in:
pavel 2026-08-27 18:05:28 +02:00
commit 117d188194
13 changed files with 162 additions and 154 deletions

View file

@ -8,13 +8,13 @@ enum PaymentResult {
fun describe(result: PaymentResult): String {
return match (result) {
PaymentResult::Accepted(id) -> "accepted " + id
PaymentResult::Rejected(reason) -> "rejected " + reason
PaymentResult::Pending -> "pending"
PaymentResult.Accepted(id) -> "accepted " + id
PaymentResult.Rejected(reason) -> "rejected " + reason
PaymentResult.Pending -> "pending"
}
}
fun main() {
val result = PaymentResult::Accepted("payment-1")
val result = PaymentResult.Accepted("payment-1")
println(describe(result))
}