Dynamic variable names: Difference between revisions

Content deleted Content added
JPD (talk | contribs)
Added Quackery.
Line 1,090: Line 1,090:
42</lang>
42</lang>
Note: most of the time when people ask how to do this on newsgroups and other forums, on investigation, it is found that a neater solution is to '''map name to value in a dictionary'''.
Note: most of the time when people ask how to do this on newsgroups and other forums, on investigation, it is found that a neater solution is to '''map name to value in a dictionary'''.

=={{header|Quackery}}==

Quackery does not have variables, but it does have ''ancillary stacks'' which can be used as variables.

<lang Quackery> [ say "The word "
dup echo$
names find names found iff
[ say " exists." ]
else
[ say " does not exist." ] ] is exists? ( $ --> )


[ $ "Please enter a name: " input
cr
dup exists?
cr cr
dup say "Creating " echo$
say "..."
$ "[ stack ] is " over join quackery
cr cr
exists? cr ] is task ( --> )</lang>

{{out}}

As a dialogue in the Quackery shell.

<pre>/O> task
...
Please enter a name: my-ancillary-stack

The word my-ancillary-stack does not exist.

Creating my-ancillary-stack...

The word my-ancillary-stack exists.
</pre>


=={{header|R}}==
=={{header|R}}==