ErrorsValues and types · rule
syntax.null_coalescing
Default for a missing value written with ??.
Area 2, Values and types; 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.
type ProductName = Text { min_length: 1}type Listing = Object { name: ProductName subtitle: ProductName?}function headline(listing: Listing) -> ProductName { return listing.subtitle ?? listing.name}
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 benonewith amatchthat handles both cases.- next
- Write
match listing.subtitlewith the armssome(subtitle) -> subtitleandnone -> listing.name(agent) - rule
- syntax.
null_ coalescing - help
- https://jadpo.
dev/docs/errors/syntax. null_ coalescing
Markdown for agents: /docs/errors/syntax.null_coalescing.md.Built from Jadpo main at aee2e8f.