Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Interesting compile error
#5
(05-19-2025, 11:32 AM)hsiangch_ong Wrote: cannot even change the type after using erase:

Code: (Select All)
redim test(1 to 10) as string

test(1) = "test me"
erase test

redim test(1 to 10) as integer

test(1) = 10000

print "That's all the test folks!"
end
i get "name already in use" from the command line.  boy i really really hate this error message.  could something else be displayed instead?

the compilation try revealed above.  tried to refigure a string array into an ordinary single string variable.  then from a variable-length string to a fixed-length string.  cannot use the same name for more than one of those items.  this was enforced since quickbasic.
I'm not a guru, so take this for what it's worth:
The Wiki says Erase changes the VALUES, so I guess the array is still there.

I find this works:

ReDim test(1 To 10) As String
test(1) = "test me"
Erase test
ReDim test%(1 To 10)
test%(1) = 10000

Print "That's all the test folks!"
End
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
Interesting compile error - by bobalooie - 05-19-2025, 02:25 AM
RE: Interesting compile error - by RhoSigma - 05-19-2025, 06:31 AM
RE: Interesting compile error - by bobalooie - 05-19-2025, 11:42 AM
RE: Interesting compile error - by RhoSigma - 05-19-2025, 02:34 PM
RE: Interesting compile error - by hsiangch_ong - 05-19-2025, 11:32 AM
RE: Interesting compile error - by PhilOfPerth - 05-19-2025, 12:10 PM
RE: Interesting compile error - by bplus - 05-19-2025, 06:14 PM
RE: Interesting compile error - by bobalooie - 05-20-2025, 12:12 PM
RE: Interesting compile error - by bplus - 05-20-2025, 02:27 PM



Users browsing this thread: 1 Guest(s)