You are here: Symbol Reference > MtxParseExpr Namespace > Classes > TMtxExpression Class > public > DefineVariable Method > TMtxExpression.DefineVariable Method (string, TValueRec)
MtxVec VCL
ContentsIndex
PreviousUpNext
TMtxExpression.DefineVariable Method (string, TValueRec)

Defines new variable of arbitrary type.

Pascal
function DefineVariable(const AVarName: string; const aVar: TValueRec): TValueRec; overload;

Use this method to define Global variables, which are shared between multiple expression objects. aVar can be constructed externally and then passed to multiple TMtxExpression objects. The name of the variable can be equal or different between TMtxExpression objects, but the value will be modified concurrently and be the same in all. This value is stored in the aVar object. The type does not need to be defined upfront, but once defined an attempt for the script to change the type will be blocked. The type can be reset to undefined with a call to aVar.Undefine.

Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!