Calling SOUL $functions: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Created page with "As of version 6.5 of the Sirius Mods, many of the Sirius $functions can be invoked using a User Language CALL statement instead of assigning the function result to a %variabl...")
 
m (add category)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
As of version 6.5 of the [[Sirius Mods]], many of the Sirius $functions can be invoked using a User Language CALL statement instead of assigning the function result to a %variable. For example:
Many of the [[SOUL]] $functions can be invoked using a <var>CALL</var> statement instead of assigning the function result to a %variable. For example:


<p class="code">
<p class="code">%L = $LISTNEW
  %L = $LISTNEW
$LISTADD(%L, 'Once upon a midnight dreary')
  $LISTADD(%L, 'Once upon a midnight dreary')
$LISTADD(%L, 'As I pondered weak and weary')
  $LISTADD(%L, 'As I pondered weak and weary')
CALL $LIST_PRINT(%L)
  CALL $LIST_PRINT(%L)
</p>
</p>


You can CALL such $functions and still test for their return code, if necessary. For
You can <var>CALL</var> such $functions and still test for their return code, if necessary. For
example:
example:


<p class="code">
<p class="code">CALL $LIST_PRINT(%L)
  CALL $LIST_PRINT(%L)
IF $LIST_PRINT(%L) THEN
  IF $LIST_PRINT(%L) THEN
  ...
      ...
</p>
</p>


"Callability" is an optional approach; it does not replace %variable assignment. The callable $functions are indicated as such on their function page. Typically they are $functions that do more than simply return a value, and the value they return is primarily an indicator of whether the function completed successfully. [[$ListCnt]], for example, is a (non-callable) $function because the function's purpose is to return a list count to the User Language program.
"Callability" is an optional approach; it does not replace %variable assignment. The callable $functions are indicated as such on their function page. Typically they are $functions that do more than simply return a value, and the value they return is primarily an indicator of whether the function completed successfully. <var>[[$ListCnt]]</var>, for example, is a (non-callable) $function because the function's purpose is to return a list count to the SOUL program.
 
[[Category:SOUL]]

Latest revision as of 19:02, 20 April 2018

Many of the SOUL $functions can be invoked using a CALL statement instead of assigning the function result to a %variable. For example:

%L = $LISTNEW $LISTADD(%L, 'Once upon a midnight dreary') $LISTADD(%L, 'As I pondered weak and weary') CALL $LIST_PRINT(%L)

You can CALL such $functions and still test for their return code, if necessary. For example:

CALL $LIST_PRINT(%L) IF $LIST_PRINT(%L) THEN ...

"Callability" is an optional approach; it does not replace %variable assignment. The callable $functions are indicated as such on their function page. Typically they are $functions that do more than simply return a value, and the value they return is primarily an indicator of whether the function completed successfully. $ListCnt, for example, is a (non-callable) $function because the function's purpose is to return a list count to the SOUL program.