RosettaCodeData/Task/Conditional-structures/Grain/conditional-structures-2.grain

16 lines
462 B
Plaintext

// A match statement more like the traditional switch statement
// often seen in other languages.
enum PizzaTopping { Cheese, Pepperoni, Peppers, Pineapple }
let topping = Peppers
match (topping) {
Cheese => print("Would it really be pizza without it?"),
Pepperoni => print("An instant classic."),
Peppers => {
// We can use a block for more expressions.
print("For those who like to spice things up.")
},
Pineapple => print("You do you.")
}