End Statements
Functions end with either an end statement, the end of the file, or the definition line for a local
function, whichever comes first. The end statement is required if:
• Any function in the file contains a nested function (a function completely contained within its
parent).
• The function is a local function within a function file, and any local function in the file uses the end
keyword.
• The function is a local function within a script file.
Although it is sometimes optional, use end for better code readability.
See Also
function
More About
•
“Files and Folders that MATLAB Accesses”
•
“Base and Function Workspaces” on page 20-9
•
“Types of Functions” on page 20-17
•
“Add Functions to Scripts” on page 18-12
20 Function Basics
20-4
Précédent

- 712/1450

Suivant