2023-12-11 15:26:13 +03:00
|
|
|
```catala
|
|
|
|
declaration structure Foo:
|
|
|
|
data x content boolean
|
|
|
|
data y content decimal
|
|
|
|
|
|
|
|
declaration enumeration Bar:
|
|
|
|
-- No
|
|
|
|
-- Yes content Foo
|
|
|
|
|
|
|
|
declaration scope Baz:
|
2023-12-19 14:03:23 +03:00
|
|
|
context a content Bar
|
2023-12-11 15:26:13 +03:00
|
|
|
output b content decimal
|
2024-01-22 18:49:58 +03:00
|
|
|
output c content list of decimal
|
2023-12-11 15:26:13 +03:00
|
|
|
|
|
|
|
scope Baz:
|
2024-01-17 19:26:41 +03:00
|
|
|
definition a equals No
|
|
|
|
|
2023-12-11 15:26:13 +03:00
|
|
|
definition b equals
|
|
|
|
match a with pattern
|
|
|
|
-- No: 0.0
|
|
|
|
-- Yes of foo: foo.y + if foo.x then 1.0 else 0.0
|
2023-12-13 18:40:22 +03:00
|
|
|
|
|
|
|
exception definition b under condition
|
|
|
|
a with pattern No
|
|
|
|
consequence equals 42.0
|
2024-01-22 18:49:58 +03:00
|
|
|
|
|
|
|
definition c equals [b;b]
|
2023-12-18 16:42:58 +03:00
|
|
|
```
|
2024-02-01 12:32:54 +03:00
|
|
|
|
|
|
|
|
|
|
|
```catala-test { id = "c" }
|
2024-02-09 12:47:30 +03:00
|
|
|
$ catala c
|
2024-02-01 12:32:54 +03:00
|
|
|
```
|