Passing parameters

Parameters can be passed within different brackets and will then be processed different ways:

(expression)
-value of parameter is calculated every time it is referred to from within the method
[code]
-value of parameter is processed only once-before the method is called
{code}
-value of parameter is processed every time it is referred to from within the method


An example to demonstrate difference between brackets:
@main[]
$a(20)
$b(10)
^sum[^
eval($a+$b)]
<hr />
^sum{^eval($a+$b)}

@sum[c]
^
for[b](100;110){
   $c
}[
<br />]

As you can see, in the first case the code was calculated only once-before method
sum was called-and the method received the result of this calculation-number 30. In the second case the code was executed every time the parameter was referred to-that is why the result was different each time, depending on the counter's value.

There can be many parameters or none. If you place many parameters inside single-type brackets, they can be separated by semicolon. Any combination of different types of parameters is allowed.

For example, the construction...
    ^if(condition){when true;when false}
...is equal to...
    ^if(condition){when true}{when false}


Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 04.09.2009