About subroutines
A subroutine is a group of source elements that performs a specific task.
A subroutine is a self-contained routine that is created from within the main app, or in a subapp, a wire, or a form that can be called from within the app. Subroutines are used to assign events to form controls in a form, and determine the logic that is executed for those events.
Using subroutines can make writing apps more efficient and easier to maintain. For example, if a subroutine performs a function that is used more than once, it can be created once and used many times within the same app, subapp, wire, or form. Other app writers can review the app without having to jump from one routine to another within the main app.
A subroutine is easy to identify within the main app or subapp, because it is called with a Call Subroutine element. This goes to the specified subroutine where it is executed. The subroutine then returns to the element in the app or subapp indicated by the flowchart.
A subroutine executes app elements until it either reaches the end or is exited using the Exit Subroutine command. Subroutines differ from subapps in terms of variable scope. Variables declared within a subroutine are known outside of the subroutine, unlike variables in subapps. Likewise, variables declared in the main body of the app are known and can be referenced within a subroutine. The only branches that are allowed are within the subroutine or to the main body of the app.
The types of subroutines that can be used in an app depend entirely upon the app itself. For example, a directed app might contain a user validation subroutine, an exit subroutine, and a send subroutine. Each subroutine contains the source elements and control structure elements that complete the process or send the user to the next logical place in the app.
Loading...
There was a problem loading this topic