How it works
The first order is paid and its amount is 12, which is at least 10, so the label is keep. The second order is not paid, so the label is unpaid. The small arm would match a paid order under 10. The arms are tried from top to bottom. Order comes from Models/Order.cs.
A working example
Console.WriteLine(Label(new Order("a", 12m, true)));
Console.WriteLine(Label(new Order("b", 3m, false)));
string Label(Order order) => order switch
{
{ IsPaid: true, Amount: >= 10m } => "keep",
{ IsPaid: true } => "small",
_ => "unpaid"
};
Try this
Put the stricter pattern before the broader one.
Put the stricter pattern before the broader one.