# HG changeset patch # User Doug Stewart # Date 1330134149 18000 # Node ID c1f9b54350f93099170787589f3ea6b0b178f703 # Parent b06010f12183c95ede145faff32892e8f7cf2e99 doc: improve description of functions and scripts * func.txi: Enumerate all the ways that functions can be defined. diff --git a/doc/interpreter/func.txi b/doc/interpreter/func.txi --- a/doc/interpreter/func.txi +++ b/doc/interpreter/func.txi @@ -29,6 +29,7 @@ like built-in functions. @menu +* Introduction to Function and Script Files:: * Defining Functions:: * Multiple Return Values:: * Variable-length Argument Lists:: @@ -43,6 +44,31 @@ * Organization of Functions:: @end menu +@node Introduction to Function and Script Files +@section Introduction to Function and Script Files + +There are six different things covered in this section. +@enumerate +@item +Typing in a function at the command prompt. +@item +Storing a group of commands in a file - called a script file. +@item +Storing a function in a file - called a function file. +@item +Sub-functions in function files. +@item +Multiple functions in one script file. +@item +Private functions. +@end enumerate + +Both function files and script files end with an extension of .m, for +@sc{Matlab} compatibility. If you want more than one independent +functions in a file, it must be a script file (@pxref{Script Files}), +and to use these functions you must execute the script file before you +can use the functions that are in the script file. + @node Defining Functions @section Defining Functions @cindex @code{function} statement