Even in complex projects it makes sense to split the whole project into several subroutines. This makes maintenance easier and gives a better overview over the projects structure. Every Task, whether a Cuelist or Script, can be a function. If a task is executed, it is usually processed from top to bottom. A CallAsFunction branches to the task specified, finishes the called task and returns to the next command in the calling task.
To call a task as function, select Insert → CallAsFunction in main menu or Script Editor context menu (right click Insert → CallAsFunction). That opens the Task Selector presenting all tasks (Cuelists and Scripts). Choose the task that has to be called.