LARD's builtin for loop follows the Pascal or Basic model; its parameters are a control variable, min and max values, and a body expression (see the Prime Numbers example).
In contrast the 'C' for loop is a more general mechanism where arbitary expressions are provided to initialise, increment and test the control varaible. Here is how a 'C'-style for loop could be implemented in LARD:
for(init:expr(void), incr:expr(void), test:expr(bool), body:expr(void)):expr(void)=( init; while(test) do ( body; incr ) ).The four parameters to this function are all of class expr. Most are of class expr(void), meaning that they must be passed an expression that returns no result. test is of class expr(bool), meaning that it must be passed an expression that returns a boolean result. The parameters are passed unevaulated, and are then evaluated anew each time they are called.
The following code shows how this function could be called:
a:var(int). for(a:=10,a:=a+1,a<20, ( print(a); print('\n') ) )