08-19-2005, 06:40 AM
After learning that you could return types in FB .14, I decided to try it out. Unfortunately my program doesn't work, and I can't figure out why. (I know its not my compiler, because rdc's fractal aggregation program compiles fine)
It doesn't return an error nor a warning. The box at the bottom of FB IDE pops up, but its completely blank....
Any and all help would be appreciated...Thanks alot.
Edit: I marked the line that I can comment out and my program will work. It seemingly doesn't like it when I try to actually USE the function to return a type....It doesn't mind that I have such a function. :???: :???:
It doesn't return an error nor a warning. The box at the bottom of FB IDE pops up, but its completely blank....
Any and all help would be appreciated...Thanks alot.
Code:
Type CoordType
X As Integer
Y As Integer
End Type
Declare Function MoveUp ( argCoord As CoordType ) As CoordType
screen 14, 32
Dim Shared Coord( 99 ) As CoordType
Dim TempCoord As CoordType
Function MoveUp ( argCoord As CoordType ) As CoordType
Dim TempCoord As CoordType
TempCoord.Y = argCoord.Y - 1
If TempCoord.Y < 0 Then TempCoord.Y = 0
Return TempCoord
End Function
Function Moving ()
Coord( 0 ) = MoveUp( Coord( 0 ) )
End Function
Coord( 0 ).X = 8
Coord( 0 ).Y = 2
Print "Before MoveUp"
Print Coord( 0 ).X
Print Coord( 0 ).Y
Coord( 0 ) = MoveUp( Coord( 0 ) ) ' <- IF I COMMENT OUT THIS LINE IT WORKS FINE, BUT I'M NOT RETURNING ANYTHING....
Print "After MoveUp"
Print Coord( 0 ).X
Print Coord( 0 ).Y
Sleep
End
Edit: I marked the line that I can comment out and my program will work. It seemingly doesn't like it when I try to actually USE the function to return a type....It doesn't mind that I have such a function. :???: :???: