gettingstarted
[Top] [All Lists]

Re: array/dictionary advice needed

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: array/dictionary advice needed
From: Lars Jensen <larsjensen at rcn dot com>
Date: Mon, 27 Oct 2003 16:24:59 -0500
> foo(0)=array{
>   "rowid" => "1",
>   "name" => "Mark",
>   "occupation" => "geek"
> }

Equivalent code in RB:

  dim foo(0) as dictionary
  foo(0) = new dictionary
  
  foo(0).Value("rowid") = "1"
  foo(0).Value("name") = "Mark"
  foo(0).Value("occupation") = "geek"
  
True, RB syntax isn't as accommodating as yours, but the translation is
straightforward.

And note that dictionary keys and values can be any type or class, so if
it's more convenient to access the row ID as an integer, you could say:

  foo(0).Value("rowid") = 1

You could also get closer to the syntax that you posted by wrapping all this
up in a class or function...

lj


 - - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>