title: Visual basic 6.0: function returning array
body: <p>Is there better way how to create function returning array than:</p>
  
  <pre><code>function foo
   Dim bar(1 to 2)as double
   bar(1)=1
   bar(2)=2
   foo=bar
  end function
  </code></pre>
  
  <p>and in code:</p>
  
  <pre><code>arrayx=foo
  </code></pre>
  
  <p>Because when I declare <code>Dim arrayx(1 to 2) as double</code> it throws an error "can't assign array" When I don't declare the variable arrayx it doesn't seem to have any problems.</p>