From 379daa6dd8018befca15e4a4afb584bd6bbed4b2 Mon Sep 17 00:00:00 2001 From: Oli Sturm Date: Fri, 24 Nov 2023 15:52:28 +0000 Subject: [PATCH] feat: add label sample --- samples/CS9/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/samples/CS9/Program.cs b/samples/CS9/Program.cs index 3eb02e1..c715fce 100644 --- a/samples/CS9/Program.cs +++ b/samples/CS9/Program.cs @@ -35,7 +35,9 @@ namespace CS9 { // the element lists must be "complete"! static OrderValue OrderValueCategory(Order o) => o switch { - (< 0, _) => throw new ArgumentException("Positive itemCounts please!"), + // Labels are optional here but can be useful + // for readability + (itemCount: < 0, itemPrice: _) => throw new ArgumentException("Positive itemCounts please!"), (_, < 0) => throw new ArgumentException("Positive itemPrices please!"), (>= 100, _) => OrderValue.ValuableDueToHighCount, (_, >= 1000) => OrderValue.ValuableDueToHighItemPrice,