Nesting Functions
As well as including literals, variables and operators inside your functions, you can also insert calls to other functions in order to produce more complex and powerful expressions. This is known as Nesting functions, which you will have already seen in some of our examples throughout this course. When a nested function is evaluated the result it returns is used to drive the function it is nested within.
For example, you might want to concatenate a calculated number together with a literal string, to give you a meaningful statement such as “The remainder of integer division of 16 by 5 is 1”. The following expression produces this result.
Concat( "The remainder of integer division of 16 by 5 is ", Mod( 16, 5 ) );
In this example, the Mod function is nested inside the Concat function.
One of the most common uses for function nesting is creating multiple branching paths within an If statement:
if( HasBeard = True, if( WearsGlasses = True, "Jimmy", "Abraham" ), if( WearsGlasses = True, "Sandra", "Ronald" ) );
The above expression works in the exact same manner as the following flow chart:

You can nest as many functions as you like within your expression, producing branching decision trees many times deeper than the one shown above.
<< Previous: If | Next: Lesson Summary >>