turbo-basic

An object as both an array and a variable?


I inherited this old TurboBasic code base, and I am converting it to something more modern. Can you explain how in this code snippet Wind can be both a variable and an array?

Dim Wind(1:3,2:3)

Sub WindFunction

     Shared Wind()
     local var
     Erase Wind

     Wind = 123

     var = Wind

     Wind(1,2) = 567

End Sub

Solution

  • The wikipedia page on Turbo Basic suggests that it is one of the dialects where

    are treated as totally separate variables, so in your case you have

    These dialects treat most variables' types just by their name. Only arrays need to be declared. Sometimes even arrays can be addressed without declaration, they are then assumed to be an array with one dimension and a size of 10.

    Some more links can be found here on SO (oh, just saw it's by you, too *g*): https://stackoverflow.com/questions/4147605/learning-turbobasic