Grasshopper

algorithmic modeling for Rhino

Hi all,

I am stuck with a probably quite basic problem...  my array doesn't seem to keep track of elements assigned to it in earlier iterations of the loop...

How do I do this in VB?

Thanks a lot for any help!

--------------------------

Dim j As Integer

   For j = 0 To 9

   Dim min(j) As Double

   min(j) = j + 1
   Print("min(j)= " & min(j))

   If j > 0 Then
      Print("min(j-1)= " & min(j - 1))
   End If

 Next

--------------------------

Views: 679

Replies to This Discussion

Declare the array outside of the loop so it doesn't get overwritten each iteration.

Dim min(9) As Double

For i As Integer = 0 To min.Length - 1
   min(i) = i + 1
   Print("min(i)= " & min(i))

   If (i > 0) Then
      Print("min(i-1)= " & min(i - 1))
   End If
Next


--

David Rutten

david@mcneel.com

Poprad, Slovakia

Many thanks for the quick reply, David!

I thought I'd tried that, but I guess I declared it with the "i" instead of a fixed value, so of course it didn't work...

Btw, I find it hard to use the Rhino.NET SDK documentation as a reference... is there any other Rhino-specific documentation on VB syntax and methods, besides the Grasshopper primer (which is great for a start)?

Philipp

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service