# `syntax.null_coalescing`

Default for a missing value written with `??`.

Area 2, [Values and types](../topics/values-and-types.md); not declinable; the next step is usually the agent's.

A value that may be `none` is read with a `match` that handles both cases; the edit writes it.

```jadpo
type ProductName = Text {
    min_length: 1
}

type Listing = Object {
    name: ProductName
    subtitle: ProductName?
}

function headline(listing: Listing) -> ProductName {
    return listing.subtitle ?? listing.name
}
```

```text
error: Jadpo reads a value that may be `none` with `match`, not `??`
 --> main.jadpo:11:29
   |
11 |     return listing.subtitle ?? listing.name
   |                             ^^ write a `match`
  reason: `??` gives a default for a missing value in JavaScript, TypeScript, C# and Swift, and `?:` in Kotlin; Jadpo reads a value that may be `none` with a `match` that handles both cases.
  next: Write `match listing.subtitle` with the arms `some(subtitle) -> subtitle` and `none -> listing.name` (agent)
  rule: syntax.null_coalescing
  help: https://jadpo.dev/docs/errors/syntax.null_coalescing

check failed: 1 error, 1 file
```
