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

[REBOL] Re: Iteration over object "properties"

From: carl::cybercraft::co::nz at: 29-Feb-2008 21:44

On Friday, 29-February-2008 at 12:55:01 Kai Peters wrote,
>Am not sure if I am using the proper terminology here, so please bear with > me: > >How do I iterate over the "properties" of an object? > >o: make object! [ p1: "Berlin" p2: "Germany" p3: 3'400'000 ] > >I want to get at the "property names" in string form as in "p1" "p2" and so > forth > >Thanks for any help, as always >> first o
== [self p1 p2 p3]
>> second o
== [make object! [ p1: "Berlin" p2: "Germany" p3: 3400000 ] "Berlin" "Germany" 3400000]
>> third o
== [p1: "Berlin" p2: "Germany" p3: 3400000]
>> foreach [word value] third o [probe value]
Berlin Germany 3400000 == 3400000 That help? -- Carl Read.