Specifications
Crestron SIMPL+
 
 Software 
The FUNCTION keyword is used to tell the SIMPL+ compiler that what follows is 
the definition of a function and not a function call. The FUNCTION keyword also 
specifies that there will be no return value for this function. INTEGER_FUNCTION 
and STRING_FUNCTION specify that an integer or string value will be returned as 
the result of the function. These keywords are also called the ‘function type’. 
The next keyword is a name provided by the SIMPL+ programmer that will become 
the name for this user function (called the ‘function name’). Be sure to use a unique 
name and not an existing SIMPL+ keyword, system function, or a previously 
declared variable name. Otherwise, a compile syntax error will result. 
Following the function name is the function’s argument list. If no arguments are 
needed within this function, then the list can remain empty. Otherwise, a parameter 
is defined by giving a variable type and name (i.e., INTEGER myIntArgument). 
One or more functions are possible by separating each with a comma. 
Function definitions are global to the SIMPL+ module in which they are defined. 
That is, any event function, the Function Main, or even another user-defined function 
can call a user-defined function that has been defined in the same SIMPL+ module. 
Functions defined in other modules are not accessible. 
When calling a function, it is critical not only that that function has been defined in 
the SIMPL+ module, but also that this function definition occur before the line of 
code which calls the function. For example, consider the following. 
INTEGER x; 
PUSH someSignal 
{ 
 call MyUserFunction1(); 
  x = MyUserFunction2( x, 10 ); 
} 
FUNCTION MyUserFunction1() 
{ 
  print("This is MyFunction1 runnning!\n"); 
} 
INTEGER_FUNCTION MyUserFunction2( INTEGER arg1, STRING arg2 ) 
{ 
  print("This is MyFunction2 runnning!\n"); 
} 
Programming Guide – DOC. 5789A  SIMPL+
 • 33 










