Nested functions are extremely useful, which is why basically any computer language since ALGOL60 has them. Except C.