25 lines
509 B
Markdown
25 lines
509 B
Markdown
# Match Expression
|
|
|
|
A `match` expression compares a target value against patterns from top to bottom and selects the first matching arm.
|
|
|
|
```dcdl
|
|
foo = match inputs.a.hoge {
|
|
>= 20: {
|
|
value = 200;
|
|
};
|
|
>= 10: {
|
|
value = 100;
|
|
};
|
|
_: {
|
|
value = 300;
|
|
};
|
|
};
|
|
```
|
|
|
|
`_` is the fallback pattern.
|
|
|
|
## Ordering
|
|
|
|
Arms are ordered; Decodal does not automatically select the most specific pattern.
|
|
If a broad condition appears first, narrower conditions after it are unreachable.
|