# `syntax.match_pattern`

Expected a match pattern.

Area 3, [Logic](../topics/logic.md); not declinable; the next step is usually the agent's.

A match arm names a case's data in brackets, not braces:

```jadpo
type ReceiptId = Uuid {}

type Label = Text {}

type PaymentOutcome = Enum {
    pending
    paid: {
        receipt_id: ReceiptId
    }
}

function label(outcome: PaymentOutcome) -> Label {
    return match outcome {
        PaymentOutcome.pending -> "pending"
        PaymentOutcome.paid { receipt_id } -> "paid"
    }
}
```

```text
error: A match arm names a case's data in brackets
 --> main.jadpo:15:29
   |
15 |         PaymentOutcome.paid { receipt_id } -> "paid"
   |                             ^^^^^^^^^^^^^^ expected `(name)`
  reason: An arm binds a case's data to one name, `PaymentOutcome.paid(paid)`, and reads its fields from it, as in `paid.field`.
  next: Write `PaymentOutcome.paid(paid)` (agent)
  rule: syntax.match_pattern
  help: https://jadpo.dev/docs/errors/syntax.match_pattern

check failed: 1 error, 1 file
```

The `match` examples below share a hidden file declaring
`DeliveryState { pending, sent, failed }`,
`PaymentOutcome { pending, paid: { receipt_id } }` and `Label = Text`.
