Contenuto principale

Cpp.CaseStatement Class

Namespace: Cpp
Superclasses: AstNodeProperties

Represents the case_statement nodes in the syntax tree of your code

Since R2026a

Description

The PQL class Cpp.CaseStatement represents the node case_statement in the syntax tree of your code.

// Demonstrates multiple case_statement forms
#include <vector>
int f(int x, std::vector<int> v) {
    switch(x) {
        case 42: return 1;
        case 1: { x = 2; break; }
        case 2: for (auto &e : v) x += e;
        case 3: co_yield 7; // requires coroutine support, illustrative
    }
    return 0;
}

The switch arms case 42:, case 1: { ... }, case 2: ... and case 3: co_yield 7; are all case_statement nodes matched by Cpp.CaseStatement.

Predicates

expand all

Version History

Introduced in R2026a