NOP Design Home Page


The call function runs a predefined function within a SIML program

The call function's first parameter is the function that should be called. The function being called may be an expression or a name stored in a variable. If you wish to specify a literal string, you must quote your function name.

If your function requires parameters, they are passed based on their relative positions to the functions required parameters after the 'WITH' keyword.

Call returns the value of the called function.

Sample Source

# Simple function call with no parameters

<SIML SimpleFunction>
  Say "Hello"
  Return 0

Call "SimpleFunction"

Sample Source

# Simple function call that outputs it's parameter

<SIML samplefunction REQUIRES MyLocalParameter For Input>
   Say MyLocalParameter
   Return 0

MyParameter := "Hello World"
Call "samplefunction" With MyParameter

Sample Source

# Dynamic function calls

<SIML ByReference1>
  Say "By Reference 1"
  Return 0
<SIML ByReference2>
  Say "By Reference 2"
  Return 0

i := 1
strFunctionName := "ByReference" + i
Call strFunctionName

Call ("ByReference" + 2)

Sample Source

# Function with a return value

<SIML Hello>
  Return "Hello World"

Say Call "Hello"

Related Function(s):

Minimum version: 2.0