Task

Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)



Related task

   Associative arrays/Creation


/* NetRexx program ****************************************************
* 04.11.2012 Walter Pachl  derived from REXX
**********************************************************************/
options replace format comments java crossref savelog symbols nobinary
  values='triangle quadrilateral pentagon hexagon heptagon octagon' -
         'nonagon decagon dodecagon'
  keys  ='three four five six seven eight nine ten twelve'
  kcopy=keys
  k=''                                 /* initialize the arrays      */
  v=''
  value='unknown'
  Loop i=1 By 1 While kcopy>''         /* initialize the two arrays  */
    Parse kcopy  ki kcopy;  k[i]=ki
    Parse values vi values; v[i]=vi
    End
  Loop j=1 To i-1
    value[k[j]]=v[j]
    End
  Say 'Enter one of these words:'
  Say ' 'keys
  Parse Ask z
  Say z '->' value[z]