Structure Point
Dim X as Double
Dim Y as Double
Dim Z as Double
Dim Name as String
End Structure
Sub Main()
Dim Position as Point
Dim Speed as Double = 1.0
Position = SetInitialPosition("Orbit 1")
For Angle as Integer = 0 to 359 'Default stepping is 1
Position = Plot(Position, Speed, Angle)
DrawIt(Position)
Next Angle
End Sub
Function SetInitialPosition(ByVal Name as String) as Point
Dim Vector as New Point
Vector.X = 1
Vector.Y = 0
Vector.Z = 0
Vector.Name = Name
Return Vector 'here you can alternately do this: SetIntitialPostion = Vector
End Function
Function Plot([b]ByVal[/b] aPoint as Point, ByVal Velocity as Double, ByVal Theta as Integer) as Point
...
End Function
The PLOT function above, the structure is passed by value as well. However, I could have written it to pass by reference like this:
Function Plot(ByRef aPoint as Point, ByVal Velocity as Double, ByVal Theta as Integer) as Point
...
End Function
This example isn't good because it alludes to designing a "game" where global variables are favored over proper programming design for the sake of speed.
Oops, wrong language! :flame: