aiken-lang 1.1.23

Cardano smart contract language and toolchain
Documentation
---
source: crates/aiken-lang/src/parser/expr/when/mod.rs
description: "Code:\n\nwhen a is {\n  1 | 4 | 5 -> {\n    let amazing = 5\n    amazing\n  }\n  3 -> 9\n  _ -> 4\n}\n"
---
When {
    location: 0..84,
    subject: Var {
        location: 5..6,
        name: "a",
    },
    clauses: [
        UntypedClause {
            location: 14..64,
            patterns: [
                Int {
                    location: 14..15,
                    value: "1",
                    base: Decimal {
                        numeric_underscore: false,
                    },
                },
                Int {
                    location: 18..19,
                    value: "4",
                    base: Decimal {
                        numeric_underscore: false,
                    },
                },
                Int {
                    location: 22..23,
                    value: "5",
                    base: Decimal {
                        numeric_underscore: false,
                    },
                },
            ],
            then: Sequence {
                location: 33..60,
                expressions: [
                    Assignment {
                        location: 33..48,
                        value: UInt {
                            location: 47..48,
                            value: "5",
                            base: Decimal {
                                numeric_underscore: false,
                            },
                        },
                        patterns: [
                            AssignmentPattern {
                                pattern: Var {
                                    location: 37..44,
                                    name: "amazing",
                                },
                                annotation: None,
                                location: 37..44,
                            },
                        ],
                        kind: Let {
                            backpassing: false,
                        },
                        comment: None,
                    },
                    Var {
                        location: 53..60,
                        name: "amazing",
                    },
                ],
            },
        },
        UntypedClause {
            location: 67..73,
            patterns: [
                Int {
                    location: 67..68,
                    value: "3",
                    base: Decimal {
                        numeric_underscore: false,
                    },
                },
            ],
            then: UInt {
                location: 72..73,
                value: "9",
                base: Decimal {
                    numeric_underscore: false,
                },
            },
        },
        UntypedClause {
            location: 76..82,
            patterns: [
                Discard {
                    name: "_",
                    location: 76..77,
                },
            ],
            then: UInt {
                location: 81..82,
                value: "4",
                base: Decimal {
                    numeric_underscore: false,
                },
            },
        },
    ],
}