Directives
VIA Assign Variable Indirectly
   
Formats 1. Assign to Variable: VIA var$=expression [ , var$=... ]
 
2.Assign to Composite Variable: VIA composite$,var_1$[[,subscr]]=expression[,...n]


*Note* The inner set of brackets enclosing [,subscr] are part of the syntax.


  Where:
composite$ Composite string variable. (Name of a variable defined as composite string.).
[,subscr] Optional subscript(s) of a variable in the composite string. String expression. You can include from 1 to 3 optional numeric expressions in square brackets, comma-separated, as subscripts for the variable.
expression Value you want assigned to the named variable.
var$ String variable containing the name of the variable to be used.
var_1$ to
var_2$
String expression containing the name of a variable in the composite string.
   
Description Use the VIA directive to assign a value to a variable where the variable name is contained in another string variable. The target variable's type (numeric or string) is based on the type of expression.
   
Format 1 Assign to Variable

VIA var$=expression

Use this VIA format to assign the value in the expression to a variable whose name is stored in var$ (i.e., to assign VIA the var$). If you use a string, then ProvideX automatically appends a $ to the variable name. If desired a string expression can us substituted for var$ is enclosed in parenthesis.

Example:

0030 LET ANIMAL$="pet", PET$="dog"
0040 VIA ANIMAL$="cat"
0050 PRINT ANIMAL$," ",PET$; END

When run, the result is pet cat.

   
Format 2 Assign to Composite Variable

VIA composite$,var_1$[[,subsc]]=expression[,...n]

You can assign the value of the expression to a variable in a composite string. In this format, you can specify up to 3 subscripts for the variable(s).

Example:

0010 IOLIST X$,Y$,Z$
0020 DIM PET$:IOL=0010
0030 LET X$="Dogs",Y$="Cats",Z$="!" REM Assign values to variables
0040 VIA PET$,"X$"="Lotsa",PET$,"Y$"="and",PET$,"Z$"="It's raining"
0050 PRINT PET.X$," ",X$," ",PET.Y$," ",Y$
0060 LET PET.X$=X$,PET.Y$=Y$
0070 PRINT PET.Z$," ",PET.Y$," and ",PET.X$,Z$
-:run
Lotsa Dogs and Cats
It's raining Cats and Dogs!