StDoodle: In a way, a function is just another kind of flow control, like a while loop. If you have code which is going to be repeated in your function, putting it in a nested function can make a lot of sense.
For me the main reason to use a nested function rather than a loop is when I can use the return value to avoid declaring a temporary variable. As a fairly bad example, rather than
PHP:
int a = item_amount(thingy);
if (a < 1) a = 1;
perform_action(a, thingy);
I can do
PHP:
int max(int a, int b) { if (a > b) return a; return b; }
perform_action(max(1,item_amount(thingy)), thingy);
Basically, I really don't like declaring temporary variables which will stick around longer than their usefulness -- or overloading variables in-script, which can be confusing. Return values seem much more suited to the task. Since ASH is Java-based, I would assume that resources are eventually "garbage collected" rather than immediately freed, but it seems a better practice regardless.
Of course, in the end, it doesn't matter as long as the script works well.