Task

Create a variable with a user-defined name.

The variable name should not be written in the program text, but should be taken from the user dynamically.



See also
   Eval in environment is a similar task.


 
Module DynamicVariable {
      input "Variable Name:", a$
      a$=filter$(a$," ,+-*/^~'\({=<>})|!$&"+chr$(9)+chr$(127))
      While a$ ~ "..*"  {a$=mid$(a$, 2)}
      If len(a$)=0 then Error "No name found"
      If chrcode(a$)<65 then Error "Not a Valid name"
      Inline a$+"=1000"
      Print eval(a$)=1000
      \\ use of a$ as pointer to variable
      a$.+=100
      Print eval(a$)=1100
      \\ list of variables
      List
}
Keyboard "George"+chr$(13)
DynamicVariable
 