Typically, functions do not require an end statement However, to nest any function in a program file, all functions in that file must use an end statement You cannot define a nested function inside any of the MATLAB ® program control statements, such as if/elseif/else, switch/case, for, while, or try/catch You must call a nested function either directly by name (without using feval), or ....