VarSet
- sets the value of dynamic variable

Miscellaneous functions
(AmiBroker 4.60)


SYNTAX VarSet( ''varname'', value )
RETURNS NUMBER
FUNCTION Sets the value of dynamic variable. Returns 1 on success, 0 on failure.

Dynamic variables are variables that are named dynamically, typically by creating a variable name from a static part and a variable part. The following example dynamically constructs the variable name from a variable prefix and a static suffix. Dynamic variables are always global. Starting from version 6.10 the function accept matrix variables in addition to numbers and arrays.

EXAMPLE for( i = 1; i < 10; i++ )
{
VarSet( "C"+i, Ref( C, -i ) );
}

// creates variables C1, C2, C3, C4, ...., C10 equal to Ref( C, -1 ), Ref( C, -2 ),   ..., Ref( C, -10 )
// respectively
SEE ALSO VarGet() function , VarGetText() function , VarSetText() function

References:

The VarSet function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.