Navigation: Using Visual Build > Panes > Step Panes > Subroutine Steps Pane |
|
The Subroutine Steps pane is where project subroutines are defined. Subroutines can be very useful for modularizing the code in your project. If there is a common set of steps that needs to be used in multiple locations in your build, you can place them in a subroutine and call them from several places in the project.
A subroutine is defined as any step (other than a Subroutine Call action step) at the main level (no indentation) of the Subroutine Steps pane, and it is comprised of that step and any child steps (indented below that step). Each subroutine should be given a unique name; if two subroutines with the same name are defined, the first one will be called.
To call a subroutine, add a step with the Subroutine Call action to your project. The custom action screen for this action allows the selection or entry of a subroutine step name and temporary macros to be defined before the subroutine steps are called (these macros values will also be deleted or their original value restored when the subroutine call returns). Subroutine steps can reference any available macro name, not just those defined in this list, but this provides a convenient way to quickly define any macros to pass to the subroutine steps.
Subroutine steps can be called from Project steps, Failure steps, child Subroutine steps, or Global Subroutines. Project subroutines will always be searched first for a matching subroutine name, and if not found, the global subroutine steps will be searched (this allows global subroutines to be overridden by a project subroutine of the same name). When a subroutine returns, all the temporary macros defined for calling that subroutine will be deleted, so be sure to use unique parameter names across subroutines when one subroutine calls another subroutine.