Integer = 0 To 9
val *= 2
lst.Add(val)
Next
Since val is a ValueType, when we assign it to the list we actually put a copy of val into the list. Thus, the list contains the following memory layout:
[0] = 2
[1] = 4
[2] = 8
[3] = 16
[4] = 32
[5] = 64
[6] = 128
[7] = 256
[8] = 512
[9] = 1024
Now let's assume we do the same, but with OnLines:
Dim ln As New OnLine(A, B)
Dim lst As New List(Of OnLine)
For i As Integer = 0 To 9
ln.Transform(xform)
lst.Add(ln)
Next
When we declare ln on line 1, it is assigned an address in memory, say "24 Bell Ave." Then we modify that one line over and over, and keep on adding the same address to lst. Thus, the memory layout of lst is now:
[0] = "24 Bell Ave."
[1] = "24 Bell Ave."
[2] = "24 Bell Ave."
[3] = "24 Bell Ave."
[4] = "24 Bell Ave."
[5] = "24 Bell Ave."
[6] = "24 Bell Ave."
[7] = "24 Bell Ave."
[8] = "24 Bell Ave."
[9] = "24 Bell Ave."
To do this properly, we need to create a unique line for every element in lst:
Dim lst As New List(Of OnLine)
For i As Integer = 0 To 9
Dim ln As New OnLine(A, B)
ln.Transform(xform)
lst.Add(ln)
Next
Now, ln is constructed not just once, but whenever the loop runs. And every time it is constructed, a new piece of memory is reserved for it and a new address is created. So now the list memory layout is:
[0] = "24 Bell Ave."
[1] = "12 Pike St."
[2] = "377 The Pines"
[3] = "3670 Woodland Park Ave."
[4] = "99 Zoo Ln."
[5] = "13a District Rd."
[6] = "2 Penny Lane"
[7] = "10 Broadway"
[8] = "225 Franklin Ave."
[9] = "420 Paper St."
--
David Rutten
david@mcneel.com
Poprad, Slovakia…
Added by David Rutten at 6:26am on September 9, 2010
Nothing spectacular, I needed to find all integer pairs for which n/k with n and k being in between 1 and 100 yields a two decimal result the first of which equals 9.
Added by David Rutten at 4:10am on September 27, 2015
ine between: item 1 {0;0} treeA and {0;0;1} treeB
line between: item 2 {0;0} treeA and {0;0;2} treeB
line between: item 0 {0;1} treeA and {0;0;0} treeB
line between: item 1 {0;1} treeA and {0;0;1} treeB
line between: item 2 {0;1} treeA and {0;0;2} treeB
I solved the problem in a static way: I banged and grafted every branch of the treeA. Then I put two line components to draw two lines groups between the treeA branches and the treeB.
That's not what I'm looking for.
What I need is that if in the treeA the branches number changes then the algorithm draws lines automatically.
I attached the gha. file.
Thanks for your help.…
n Continue For
End If
Next
actually for performance issue, I should put "the continue for " on the first:
Dim i As Integer
For i = 0 To 9
If x <> 3 Then Continue For
If x = 3 Then
print("The number is 3.")
End If
Next…
e
7. True
8. True <-- this one
9. True
10. False
11. True
12. False
13. True
14. True <-- this one
15. True
16. False
17. True
18. False
19. True
20. True <-- this one
21. True
22. False
23. True
24. False
25. True
26. True <-- this one
27. True
28. False
29. True
30. False
31. True
32. True <-- this one
33. True
Any idea how I can solve this?
Thanks!…