Keywords
Version 23.4.8839
Keywords
Version 23.4.8839
Statements in ArcScript are defined using keywords, XML elements prefixed with “arc:”. Keywords include the usual features of a programming or scripting language, such as conditionals, loops, and flow control. However, ArcScript also includes special keywords tailored specifically for feed manipulation and generation; for example, arc:call, arc:enum, and arc:set.
Most keywords take parameters that define or affect their behavior. Parameters are specified as XML attributes of the keyword element. The required and optional parameters, along with code examples, for each keyword are explained in this section.
Keyword Scope
In ArcScript, some keywords introduce scope; that is, some keywords can be nested inside the bodies of other keywords, and how they are nested is meaningful to the language:
- You can define instructions for an iteration within a keyword’s scope: For example, the body of an arc:call keyword is executed for each item in the feed produced by the operation invoked by arc:call. Because of this, keywords nested inside arc:call are executed for each iteration to produce each item in the feed.
- Scope associates matching pairs of keywords; for example, the arc:else keyword defines an alternate execution path for a conditional keyword like arc:equals or arc:check. In ArcScript, a certain arc:else keyword is associated with a conditional statement when it is nested as a direct child of the conditional statement. Thus, the arc:else keyword must not be defined outside of the scope introduced by a conditional keyword.
- Keywords can introduce new items (variables) within their scope. For example, the arc:call keyword will introduce a default output item representing the item being iterated over in the feed being generated.
- Keywords can inject additional attributes into the default item that provide more information within their scope. These attributes are called Control Attributes when described in this document. They are easily recognized because they start with the _ character; for example, _attr, _index, _value, etc.