Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Passing hash keys to functions

From: SunandaDH:aol at: 28-Dec-2004 16:16

> I'm trying to write a function that accepts a key as an argument, and > then returns the corresponding value.
You might be better off with the keys as strings rather than words: hsh: make hash! ["a" [1 2] "b" [3 4]] The code hardly needs a function: select hsh "b" == [3 4] But if you want one: get-val: func [of [hash!] key [string!] ][ return select of key ] get-val hsh "b" == [3 4] Sunanda