Contents Previous Next Subchapters

Local Variable Functions
Syntax local function new function = existing function ( identifier list )
See Also arguments

Description
Creates a new variable function with file scope .

Tutorial
Local variable functions are limited in scope to the file in which they are defined. If the file TEMP.OMS contains
     local function f = g(x)
     print f
and you enter the commands
     clear
     function g(x) begin
          return x
     end
     function f() begin
          return 2
     end
     x = 1
     include TEMP.OMS
O-Matrix will respond
     1
because the function call f within the file TEMP.OMS returns the value of g(x), which is 1. If you continue by entering
     print f
O-Matrix will respond
     2
because the function f within TEMP.OMS is no longer visible.

Reference
This syntax can only be used inside of a file (not at the command line).