Nested Functions

Nested functions are functions within the main function.

They can use variables defined in the function that they are within (the parent function). These variables do not have to be passed into the child function (the function that is nested within the parent) in any way. The end at the end of the function MUST be used for both the parent and the child function as to know when each ends. The child function can be called directly within the parent function.
function x=outer(a)
b = 2
function y=inner(a)
y=a*b
end
inner(a)+b
end