Dynamic variable names: Difference between revisions

From Rosetta Code
Content added Content deleted
(+ Tcl)
(toc)
Line 1: Line 1:
{{task}}Create a variable with a user defined name.
{{task}}Create a variable with a user defined name.
__TOC__

=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
<lang AutoHotkey>
<lang AutoHotkey>

Revision as of 05:45, 2 June 2009

Task
Dynamic variable names
You are encouraged to solve this task according to the task description, using any language you may know.

Create a variable with a user defined name.

AutoHotkey

<lang AutoHotkey> inputbox, dynamic, variable name %dynamic% = hello ListVars msgbox % %dynamic%  ; says hello </lang>

Common Lisp

<lang lisp>

(defmacro set-string (string value) 
 `(setf 
   ,(read-from-string string) 
   ,value))
(set-string "dynamicA" "hello")

(print dynamicA) </lang>

Tcl

<lang Tcl>puts "Enter a variable name:" gets stdin varname set $varname 0</lang>