AMT Help Files
homeLION Language ReferenceCommandsPERFORM

PERFORM

Syntax

PERFORM (<Label name> [, <Label name>])

Description

Performs (executes) the first specified paragraph given by the first label and then continues until the last specified paragraph given by the second label has been executed or until an EXIT PERFORM is encountered. After this, AMT will jump back to the line directly after the PERFORM instruction.

Diagram

Returned value type

None

Parameters

Parameter Description
<Label name> Specification for the label(s) that indicate the paragraph(s) that must be performed.

Remarks

When using a single label the code lines between that label and the next label will be first executed and then all the code lines directly after the perform command, see Example 1. Labels in other routines can be used, with syntax <routinename>.<labelname>, see example 2. Performs using the same end label can be nested as shown in example 3.

Any GOTO instructions that could lead to an incomplete execution of the PERFORM instruction must be avoided because this would make the results unpredictable.

See also the examples for the EXIT instruction.

Examples

Example 1
routine performexample1
begin_routine
  result := ''
  perform (laba)
  result += '0'
  :laba
  result += '1'
  result += '2'
  :labb
  result += '3'
  result += '4'
  :labc
  result += '5'
end_routine
// after execution, the value of result will be '12012345'
Example 2
routine performexample2
begin_routine
  result := ''
  perform (laba, labb)
  result += '0'
  :laba
  result += '1'
  result += '2'
  :labb
  result += '3'
  result += '4'
  :labc
  result += '5'
end_routine
// after execution, the value of result will be '1234012345'
Example 3
routine performexample3
begin_routine
  result := ''
  perform (perform2.laba, labb)
  result += '0'
  :laba
  result += '1'
  result += '2'
  :labb
  result += '3'
  result += '4'
  :labc
  result += '5'
end_routine
// after execution the value will be '8765012345'

routine perform2
begin_routine
  result += '9'
  :laba
  result += '8'
  result += '7'
  :labb
  result += '6'
  result += '5'
  :labc
  result += '4'
end_routine
Example 4
routine performnested
begin_routine
  result := 'start'
  perform (start1, end)
  goto (end)

  :start1
  result += ',start1begin'
  perform (start2, end)
  result += ',start1end'
  goto (end)

  :start2
  result += ',start2begin'
  perform (start3, end)
  result += ',start2end'
  goto (end)

  :start3
  result += ',start3'

  :end
end_routine
// after execution result will be 'start,start1begin,start2begin,start3,start2end,start1end'

Return to

Commands

Contents

 Go to top