Multiple assignments

[Autolink] Menu

You can use the PARSE instruction to assign one value to two or more variables in one statement.
Example:

 
/* assign a value to more than one variable in one statement          */

  parse value directory() with 1 dirString1 1 dirString2
                        /* now dirString1 and dirString2 both contain */
                        /* the name of the current directory          */

  parse var sourceVar 1 targetVar1 1 targetVar2 1 targetVar3
                        /* now the variables targetVar1, targetVar2   */
                        /* and targetVar3 all contain the value of    */
                        /* sourceVar                                  */

(see also Get the current screen size for a working example)


[Back: Initialization of variables]
[Next: Using parse to split a string]