Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

label

  • Last UpdatedFeb 19, 2025
  • 2 minute read

The label statement is used inside a Coroutine to create a jump point for the goto statement.

Note: Label names MUST be unique inside a Coroutine.

Platform support

This element is supported on all platforms.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Jumping among statements

Specific positions inside the Coroutine can be tagged with a label. Using the goto node, it is possible to instantly move to that specific position. Goto statements can be placed inside the Coroutine statement flow or even inside a wait block. Labels cannot be inside a wait statement.

<label name="aLabel"/>

….

….

<goto label="aLabel" condition="aCondition" />

By using label and goto statements, a Coroutine can be easily turned into state machine. This opens a lot of opportunities and let users script complex behaviors in a very compact way.

Users should keep in mind when designing their Coroutine that local variable declarations can only happen one time, so jumping back to a point of the Coroutine where local variables are declared will cause an error.

Code example

This is a code example for a label statement.

<label name="aLabel" />

Fields

These are the fields for the label statement.

Fields

Type

Use

Default value

Description

name

sstring

Mandatory

Not set

Unique identifier for the label.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in