A procedure can define parameters. Unlike features provided by the RainCode runtime environment that can handle variable length parameter lists, calling a user-defined procedure requires that the exact number of parameters is supplied. However, there is no way one can restrict the types of the arguments. Any such type checking must be performed by user code.
On the other hand, such user-defined type checking can prove very convenient:
PROCEDURE Dump (a);
BEGIN
IF SYS.IsList(a) THEN
OUT.Write("{ ");
FOR e IN a DO
OUT.Write (e, " ");
END;
OUT.WriteLn ("}");
ELSE
OUT.WriteLn (a);
END;
END Dump;
In this example, one checks whether the argument is a list in which case a special treatment is performed.
The arguments are always passed by value, that is, RainCode makes a copy of each value passed as parameter to a procedure, and any alteration to the parameter from within the procedure will only alter this copy which will be discarded when the procedure terminates.