Comparison of programming languages (associative array): Difference between revisions

Content deleted Content added
KolbertBot (talk | contribs)
Tcl: Fixing style/layout errors
Line 1,308:
 
=== [[Tcl]] ===
There are two Tcl facilities that support associative array semantics. An array is a collection of ''variables''. A '''dict''' is a full implementation of associative arrays.
array is a collection of ''variables''. A '''dict''' is a full implementation
of associative arrays.
 
'''dict'''
Line 1,318 ⟶ 1,316:
</source>
 
To lookuplook up an item:
 
<source lang=Tcl>
Line 1,341 ⟶ 1,339:
</source>
 
If there is a literal space character in the variable name, it must be grouped using either curly brackets (no substitution performed) or double quotes (substitution is performed).
grouped using either curly brackets (no substitution performed) or double
quotes (substitution is performed).
 
Alternatively, several array elements can be set in a single command by providing their mappings as a list (words containing whitespace are braced):
providing their mappings as a list (words containing whitespace are braced):
 
<source lang=Tcl>
Line 1,370 ⟶ 1,365:
</source>
 
The result can be (order of keys is unspecified, not because the dictionary is unordered, but because the array is):
unordered, but because the array is):
 
<source lang=Tcl>