Dynamic variable names: Difference between revisions

Lingo added
m (added whitespace before the TOC (table of contents), added a ;Task: (bold) header, added other whitespace to the task's preamble.)
(Lingo added)
Line 278:
'<a href="?thename=xyz">Please give the variable a name!</a>'
^}</lang>
 
=={{header|Lingo}}==
<lang lingo>-- varName might contain a string that was entered by a user at runtime
 
-- A new global variable with a user-defined name can be created at runtime like this:
(the globals)[varName] = 23 -- or (the globals).setProp(varName, 23)
 
-- An new instance variable (object property) with a user-defined name can be created at runtime like this:
obj[varName] = 23 -- or obj.setProp(varName, 23)</lang>
 
=={{header|Logtalk}}==
Anonymous user