Porting Question & Info

 BBS: Inland Empire Archive
Date: 06-10-92 (19:47)             Number: 167
From: MATT HART                    Refer#: NONE
  To: JEFFERY FOY                   Recvd: NO  
Subj: Porting Question & Info        Conf: (2) Quik_Bas
 >MH>I was wrong on one account - you can use Conference as both a
 JF> TYPE definition
 JF> Could you illustrate that with code?

You can do this:
     TYPE Conference
          Anything AS STRING * 10
     REDIM Conference(1 TO 6550) AS Conference

But I usually do this:
                     v-----< I add the suffix name "Type"
     TYPE ConferenceType
     REDIM Conference(1 TO 6550 AS ConferenceType

Don't ask me why - it is no big deal to do it either way.

 JF> What about "$" as the first character? Would that work?

Nope - it MUST be a letter.  THEN you can use a number or a
period.  The $ has a specific meaning in BASIC.  Remember,
with BASIC, there is ALWAYS a default variable type, single
precision.  You can change this default with the DEF??? A-Z
(DEFINT A-Z for integer, DEFLNG A-Z for long integer,
etc...).  The $ is reserved as a suffix to indicate a
string type variable.  In BASIC, the following are all

     A%        Integer
     A&        Long Integer
     A!        Single Precision
     A#        Double Precision
     A$        Variable length string
     A@        Currency (if you have PDS)

You can have variables like:

Of course, good programmers use descriptive variables.

 JF> I figured that one out. (Remember, I DO know C/C++ already)  :)

There are really only a few difference in programming in C
and modern BASIC.  You have no procedural brackets or line
ending characters or anything like that in BASIC.
Procedural and conditional statements are indicated by
keywords.  A block IF condition in C must have brackets,
but in BASIC, you just type in the commands in a block
structure, and that is the way it will come out.

     if (a==b)

     IF a = b THEN
          CALL dostuff
          CALL domorestuff
          CALL differentstuff

The keywords THEN and ENDIF are substitued for the cryptic
{ and ;.  I think that "THEN" says more than "{", and
"ENDIF" says more than ";".

Also, BASIC distinguishes procedures from variables.
Either a CALL is made to a procedure that would be a VOID
in C, and a declaration as a function is made at the top of
the program, just as it is in C, for a procedure that
returns a value.  Any BASIC procedure that returns a value
MUST be assigned to a reciever.  In C, you can stick an
integer procedure on a line by itself, and it's value will
be sent into the bit bucket.  The BASIC compiler won't
allow this, the function must be assigned.

int procedure;


Procedure%           <<< Can't do this, it must be assigned
Dummy% = Procedure%
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET