Return Statement

A Return statement transfers execution to the calling context (invoking expression), while supplying a value to a rule, function, or method.

Return <expression>

If a rule includes a statement block, the returned value must either be assigned to the name of the rule, or returned by using the Return keyword.

In a function (or method), a resulting value must either be assigned to the name of the function (or method), or is returned by using the Return statement. The value is returned to the calling expression.

Rule numList As List = {2,4,6,8,10,12,14,16,18,20}

Rule value5 As Number = GetFifth(numList)

Method GetFifth (inList As List) As Number
   If length(inList) >= 5 Then
      Return nth(5, inList)
   Else
      Return NoValue
   End If
End Method