Records and pattern matchingbeginner
A record is a type that cannot be changed after it is built, and a switch expression makes a decision the compiler can check for gaps — together they delete most of the if/else you would otherwise write.
A mutable class and a ladder of if/else. Make the type immutable and the decision one expression.
Same prices, a type nobody can mutate, and a decision in one expression.
Published in full, before you start — every point is one of these and there is nothing else.
A record is a type that cannot be changed after it is built, and a switch expression makes a decision the compiler can check for gaps — together they delete most of the if/else you would otherwise write.