Function Basics
20
Create Functions in Files......................... 20-2
Syntax for Function Definition................... 20-3
Contents of Functions and Files .................. 20-4
End Statements.............................. 20-4
Add Help for Your Program ....................... 20-6
Run Functions in the Editor....................... 20-8
Base and Function Workspaces................... 20-10
Share Data Between Workspaces .................. 20-11
Introduction................................ 20-11
Best Practice: Passing Arguments ................ 20-11
Nested Functions............................ 20-12
Persistent Variables.......................... 20-12
Global Variables ............................. 20-13
Evaluating in Another Workspace................ 20-14
Check Variable Scope in Editor ................... 20-16
Use Automatic Function and Variable Highlighting... 20-16
Example of Using Automatic Function and Variable
Highlighting.............................. 20-17
Types of Functions.............................. 20-20
Local and Nested Functions in a File............. 20-20
Private Functions in a Subfolder................. 20-21
Anonymous Functions Without a File ............. 20-21
Anonymous Functions ........................... 20-24
What Are Anonymous Functions?................ 20-24
Variables in the Expression ..................... 20-25
Multiple Anonymous Functions .................. 20-26
Functions with No Inputs ...................... 20-27
Functions with Multiple Inputs or Outputs ......... 20-27
Arrays of Anonymous Functions................. 20-28
Local Functions................................ 20-30
xxi