CTCL

Call Statement

call foo
call bar(red,blue)
call barsup(100,blue,green)

colora = succ(colora)
k = lctrandom(4) + 2
The call statement is simply a function call without return, a.k.a. "procedure call". There are two kinds of functions or procedures:
  1. "Built-in" functions, compiled in from CTCL7.cpp. These are written in C++. You may add more as necessary. These functions may or may not return a value, depending on how they are to be used. By nature, CTCL does not require the use of very involved functions and procedures.
  2. "Procedures" written in CTCL. These follow the language rules as outlined in the page on procedures. Of necessity, procedures to control light patterns must be written in CTCL, since references to structure names all disappear into the symbol table and structure file halfway through compilation. (A feature could be added to look up structure names and supply addresses in the function calls, but it's not really needed yet.)

Following the rather odd Pascal-like protocol, a procedure call without parameters has no parentheses following, as in "call foo above. Other than that, the parameter list follows the usual rules, i.e. variables and/or constants separated by commas.

Function calls that return values are embedded within expressions as in C and other procedural languages. Such functions must have parentheses.