what does the & represent here?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Selected& = Device_Display.ListIndex

sometime i do see $ replacing the &, what does it mean also?
 
These are the notorious "ancient type specifiers".
Sometime way, way back in the history of the Basic language someone decided
that it would be nice to allow declaring variables with merely a single
character at the end of the name to signify the type of the variable.

e.g.,
Dim SomeString$ 'instead of Dim SomeString As String
Dim SomeLong& 'instead of Dim SomeLong As Long
(there are a handful of others to cover the basic types that existed in
early versions of VB).

In code, you could then refer to "SomeString$" or "SomeString" - both refer
to the variable declared as SomeString$.

And strangely enough, VB.NET *still* allows this archaic usage.

David Anton
Tangible Software Solutions
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter and the Instant VB C# to
VB.NET converter
 
David,

David Anton said:
In code, you could then refer to "SomeString$" or "SomeString" - both
refer
to the variable declared as SomeString$.

And strangely enough, VB.NET *still* allows this archaic usage.

That's one of the rare cases where VB.NET is compatible with VB Classic :-).
 
David,
Actually early versions Basic only supported variables with a single
character optionally followed by the type character or a single character
followed by a digit optionally followed by the type character.

So as your variables you could only use:
a$
l&
A1
A2$

Its been too long, I don't think that "Dim" was even a keyword, I know "Dim"
was in QBasic (Quick Basic), however I don't remember it in GWBasic...

I mean early versions, such as Cassette Basic that was included in ROM on
the original IBM PC. Remember Basic was "old" when Cassette Basic came out!

Here's an Extended Cassette Basic manual:

http://www.thebattles.net/sol20/manuals/extcassbasic.pdf

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top