Methods

Methods are function-like rules which take arguments. They are very similar to functions but are evaluated in the context of the part on which they are invoked. A method is typically used to replace a set of statements that occurs more than once in the design.

Methods differ from functions in that you define them inside a design, similar to rules. A method has the same syntax as a function; it can have parameters and it returns a value of a specific data type.

A method can take any number of parameters (see Parameters). Like functions and basic rules, a method’s statement block must contain at least one assignment to the Method’s name (optionally use the Return Statement).

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

Methods are typically referenced from rules in the same design. However you can use reference chain syntax to access a method from another design (same as to access a rule).

Rule val4 as Number = part2.fourth(numList)
Note: Dynamic methods are not supported.