AMT Help Files
homeLION Language ReferenceCommandsLOOP...ENDLOOPLOOP FOR EACH (xmlnode)

LOOP FOR EACH (xmlnode)

Syntax

LOOP FOR EACH <XmlNode> IN <XmlNodes>
  <Code lines>
ENDLOOP

Description

Loops through all the occurrences in the list of <XmlNodes>. The current node will be available in the variable <XmlNode>.

Diagram

Returned value type

None

Parameters

Parameter Description
<XmlNode> A variable of type XMLNODE to hold the current node in the list of XmlNodes
<XmlNodes> The list of XmlNodes to cycle through
<Code lines> Code that is performed each time the loop is executed. The loop will be terminated in one of the following cases:
  • When a BREAK command is encountered
  • When a GOTO command is encountered that refers to a label outside the loop.
  • When an EXIT command is encountered. This command jumps out of the current routine and therefore it exits the LOOP also.

Example

i := 1
loop for each currnode in nodeslist
  currnode.value := 'Node ' + format (i, onezero)
  i += 1
endloop

Contents

 Go to top