Hash from two arrays: Difference between revisions
Content added Content deleted
(→{{header|C++}}: updating boring demo to C++11 (this is 2018 now), dropping transform demo that doesn't compile, adding range v3 demo) |
No edit summary |
||
Line 1,406: | Line 1,406: | ||
<pre> |
<pre> |
||
key: phive value: pentagon |
key: phive value: pentagon |
||
</pre> |
|||
=={{header|Ring}}== |
|||
<lang ring> |
|||
# Project : Hash from two arrays |
|||
# Date : 2018/03/18 |
|||
# Author : Gal Zsolt [~ CalmoSoft ~] |
|||
# Email : <calmosoft@gmail.com> |
|||
list1="one two three" |
|||
list2="1 2 3" |
|||
a = str2list(substr(list1," ",nl)) |
|||
b = str2list(substr(list2," ",nl)) |
|||
c = list(len(a)) |
|||
for i=1 to len(b) |
|||
temp = number(b[i]) |
|||
c[temp] = a[i] |
|||
next |
|||
for i = 1 to len(c) |
|||
see c[i] + " " + i + nl |
|||
next |
|||
</lang> |
|||
Output: |
|||
<pre> |
|||
one 1 |
|||
two 2 |
|||
three 3 |
|||
</pre> |
</pre> |
||