Define a collapsible segment in a Structured Text routine

Outlining organizes a Structured Text routine into collapsible segments. Use automatic outlining to automatically define collapsible segments, or define collapsible segments using the #region and #endregion keywords.
To use outlining constructs:
  1. At the start of the first line in the segment, enter a beginning construct, such as
    #region
    . The following constructs are supported:
    • if
      . . .
      end_if
    • case
      . . .
      end_case
    • for
      . . .
      end_for
    • while
      . . .
      end_while
    • Repeat
      . . .
      end_repeat
    • #region
      . . .
      #endregion
    • /*
      . . .
      */
      for multi-line comments
    • (*
      . . . *) for multi-line comments
  2. At the start of the last line in the segment, enter the ending construct, such as
    #endregion
    .
    The following example shows a simple segment:
    RegionExample_STEditor_v31
    To navigate between associated matching keywords for the keyword at the cursor location, select
    Search > Matching Keyword
    , or press
    Ctrl
    +
    ]
    .
    TIP:
    The
    #region . . . #endregion
    construct does not execute, so it can precede an SBR instruction at the beginning of a routine.
TIP:
The
#region . . . #endregion
construct can be used as part of a statement within a built-in construct, such as a CASE_OF statement. The following example shows the
#region . . . #endregion
construct in a CASE_OF statement, with regions expanded and collapsed:
RegionInCASE_OF_v31 RegionInCASE_OF2_v31
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.