calc
This function calculates the expression either formulated as direct code or provided in a string. The return value will be provided as calculated in the expression
Indirect parameter passing is disabled
1
No. | Type | Description |
---|---|---|
1 code |
expression :string |
expression to calculate |
Type | Description |
---|---|
all types | Return value It is the return value as provided by the specified expression |
ex[] = "sqrt( x[]*x[] + y[]*y[] )";
x[] = 3;
y[] = 4;
r[] = calc( sqrt( x[]*x[] + y[]*y[] ) );
echo("Output r[] = ", r[] );
r[] = calc( : ex[] );
echo("Output r[] = ", r[] );
// Note the required colon. Otherwise ex[] as variable is returned.
Output r[] = 5
Output r[] = 5