Associative array/Iteration: Difference between revisions
Content added Content deleted
Walterpachl (talk | contribs) m (→{{header|NetRexx}}: remove savelog) |
|||
Line 2,465: | Line 2,465: | ||
1.620000 |
1.620000 |
||
3.140000 |
3.140000 |
||
</pre> |
|||
=={{header|VBScript}}== |
|||
<lang vb> |
|||
'instantiate the dictionary object |
|||
Set dict = CreateObject("Scripting.Dictionary") |
|||
'populate the dictionary or hash table |
|||
dict.Add 1,"larry" |
|||
dict.Add 2,"curly" |
|||
dict.Add 3,"moe" |
|||
'iterate key and value pairs |
|||
For Each key In dict.Keys |
|||
WScript.StdOut.WriteLine key & " - " & dict.Item(key) |
|||
Next |
|||
</lang> |
|||
{{Out}} |
|||
<pre> |
|||
1 - larry |
|||
2 - curly |
|||
3 - moe |
|||
</pre> |
</pre> |
||