Labeled Statement
LabeledStmt Entity
In Java, a labeled statement allows you to assign an identifier (label) to a specific block of code or statement. Labels are most commonly used with break and continue statements to control the flow of nested loops or blocks. When using a labeled statement, you place the label name followed by a colon (:) before the statement or block you want to label. This is particularly useful when you need to break out of or continue a specific outer loop from within a nested loop structure.
Example
Attributes
Method | Description |
---|---|
GetAPrimaryQlClass() string | Returns the primary CodeQL class name for this entity |
GetHalsteadID() int | Returns the Halstead complexity metric identifier for the labeled statement |
GetLabel() *LabeledStmt | Returns a pointer to the labeled statement itself |
GetPP() string | Returns the pretty-printed representation of the labeled statement |
ToString() string | Returns a string representation of the labeled statement |