aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmldom/domdata/domitem/switchStatement.qml
blob: b2bacec8c0a8d16b40e61b9a9370bd0e90f51700 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQml

QtObject {
    function switchStatement(){
        const animals = "cat";
        const no = 0;
        switch (animals) {
            case "cat":
                switch (no) {
                    case 0: return "patron";
                    case 1: return "mafik";
                    default: return "none";
                }
            case "dog": {
                // check if qqmljsscope is created for this case
                const name = "tekila";
                let another = "mutantx";
                return name;
            }
            default: return "monster";
            case "moreCases!":
                return "moreCaseClauses?"
        }
    }
}