|
|
|
|
|
by rattray
2190 days ago
|
|
Yeah, came here to say the same thing. Disappointing to have to write this: match shape:
case Square(l):
area = l * l
case Rectangle(l, w):
area = l * w
case Circle(r):
area = (PI * r) ** 2
when I want to just write this: area = match shape:
case Square(l):
l * l
case Rectangle(l, w):
l * w
case Circle(r):
(PI * r) ** 2
I'm almost guaranteed to forget (or mistype) the `area = ` at least once in any match clause of length. |
|