It could be some very simple functions such as:
For a given TableName return SELECT * FROM [InputTableName] script
But Tasks could be and (much) more complex... For example:
For a given TableName, return CREATE TABLE script.
Now, in order to that complex task could be performed, the job is mainly to create a few more simple functions (i.e. Get All columns for given TableName, Get All constarints etc etc) and on the end compose all of them into 1 functionality of the main task function.