19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

456 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

for arrays declared using empty parentheses. Arrays created in procedures use dynamic allocation.<br />

[FILESPEC]: The filespec of a file on disk is a string consisting of the letter of the drive, a<br />

colon, <strong>and</strong> the name of the file. If directories are being used, the file name is preceded by the<br />

identifying path.<br />

[LINE LABEL]: Program lines that are the destinations of statements such as GoTo <strong>and</strong><br />

GoSub are identified by placing a line label at the beginning of the program line or alone on<br />

the line proceeding the program line. Line labels may be placed only at the beginning of a<br />

line, are named using the same rules as variable, <strong>and</strong> are followed by a colon. Line numbers<br />

may be used in place of line labels, but program readability is greatly improved by using<br />

descriptive line labels.<br />

[RADIANS]: The radian system of measurement measures angles in terms of a distance<br />

around the circumference of the circle of radius 1. If the vertex of an angle between 0 <strong>and</strong><br />

360 degrees is placed at the center of the circle, the length of the arc of the circle contained<br />

between the two sides of the angle is the radian measure of the angle. An angle of d degrees<br />

has a radian measure of (pi/180) * d radians.<br />

[SUBROUTINE]: A subroutine is a sequence of statements beginning with a line label <strong>and</strong><br />

ending with a Return statement. A subroutine is meant to be branched to by a GoSub statement<br />

<strong>and</strong> is usually placed after an Exit Sub or Exit Function statement at the bottom of a<br />

procedure so that it cannot be entered inadvertently.<br />

[VARIANT]: Variant is a generic variable type. Any variable that is used without a type declaration<br />

tag ($, %, &, !, #, @) or without being declared as a specific type using an As clause<br />

or a DefType statement is treated as a variant variable. A variable of type Variant can hold<br />

any type of data. When values are assigned to a variant variable, <strong>Visual</strong> <strong>Basic</strong> keeps track of<br />

the “type”of data that has been stored. <strong>Visual</strong> <strong>Basic</strong> recognizes many types of data: type 0 for<br />

“Empty” (nothing yet has been stored in the variable; the default), type 1 for “Null” (the special<br />

value Null has been assigned to the variable), type 2 for Integer, type 3 for Long integer,<br />

type 4 for Single precision, type 5 for Double precision, type 6 for Currency, type 7 for<br />

Date/time, type 8 for String, type 10 for Error, type 11 for Boolean, <strong>and</strong> type 17 for Byte. A<br />

single variant variable may be assigned different data types at different points in a program,<br />

although this is usually not a good programming technique. The data assigned to a variant<br />

array need not all be of the same type. As a result, a variant array can be used in much the<br />

same way as a user-defined type to store related data.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!