exec

Prev Next

Function Names

exec

Description

This function executes the statements either formulated as direct code or provided in a string.

Call as: procedure

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
code
statements
:string
statement to execute

Examples

       st[] = "for (a[] = 1, a[] <= 3, a[]++) echo(a[]);";

       exec( for (a[] = 1, a[] <= 3, a[]++) echo(a[]) ) ;
       exec( :st[] );

       // Note the required colon.  Otherwise st[] is seen as an incomplete statement.

Output

1
2
3
1
2
3
Try it yourself: Open LIB_Function_exec.b4p in B4P_Examples.zip. Decompress before use.

See also

calc