# Software Engineers Handbook/Language Dictionary/BASIC
## BASIC

Here is wikipedia entry.
Be warned before reading this page, that some language features here are only applicable for certain BASIC flavors.

### Type

BASIC is a full procedural language or object oriented depending on the BASIC you are using. BASIC is an acronym for Beginner's All-purpose Symbolic Instruction Code

### Execution Entry Point

Modern BASICS are usually integrated into a visual, event-driven environment; in such applications, there is no program entry point in the developer's view. In the case of a command-line REALbasic program, there is a Run event of the ConsoleApplication class which is invoked when the program begins, and which receives command-line arguments as an array of strings.

### General Syntax

BASIC syntax uses very little special punctuation, beyond those common to algebra and most other languages, such as "+" for addition. The equal sign ("=") is used for both assignment and equality testing, which raises no ambiguity since (unlike C) an assignment statement may not be used as part of another expression. Parentheses are used for grouping terms, as in algebra, as well as for indexing into arrays. A period (or dot) is used for accessing object properties or methods. Square brackets, curly braces, and other odd punctuation are not used.
Code blocks are delimited by statements; for example, an "if" block begins with an "if" statement and ends with "end if". Statements are separated by line breaks, though a statement that needs to span multiple lines can do so via a special line continuation character (" _", space followed by an underscore) and several statements can be kept in one line by using the colon (":") character, although this is usually not considered to be a good programming practice.
Here's a typical example of BASIC code:

### Comments

Both VisualBasic and REALbasic use a single apostrophe to denote a comment, which continues to the end of the line. The old REM statement may also be used, though it is no longer in fashion. REALbasic may also use C++-style "//" comments. BASIC supports no block comment mechanism, though the IDE may support quickly commenting or uncommenting blocks of code. Example:

### Variable Declarations

REALbasic is a strongly-typed language; Visual Basic is more loosely typed, an untyped variable would be automatically typed as Variant-typed (VB 6 and lower) or Object-typed (VB .NET), both of them means the variable can switch types depending on the content of the variable, simulating an untyped variable. In VB.NET, there is an option to force the declaration of type. Local variables are declared using a Dim statement:
Variable may be given initial value at declaration time. Although not for VB6.
Multiple variables may be declared on a single line, and they may be given initial values at declaration time, as shown here:
Note that an important difference exists between REALbasic and VisualBasic when two variables are declared with only one type:
In REALbasic and VB.NET, both a and b would be variables of type Double. In VB 6, b would be a Double, but a would be a Variant (essentially, an untyped variable).
Note that in the case of an object declaration, there is a further shortcut for initializing the variable to a new object instance:
Variables may also be declared as properties of classes, windows, or modules. These use the same syntax, or are edited directly by the IDE.

### Method Declaration/Implementation

Methods are defined by a Function or Sub keyword. Here is an example.

### Scope

REALbasic uses block scoping within a method; that is, a Dim statement within (for example) an If block makes a variable that goes out of scope at the end of that block. Local variables declared at the top of a method go out of scope at the end of the method. All variables declared within a method are inaccessible outside that method, and with the exception of static variables, use stack storage.
Properties of classes, modules, and windows are stored on the heap. Module properties may be private (accessible only within the module), public (accessible from anywhere by using the module name as a prefix), or global (accessible from anywhere with no prefix). Class properties may be private (accessible only within that class), protected (accessible within that class or its subclasses), or public (accessible from anywhere via an object reference). Windows are really just classes, and have the same scoping rules.

### Conditional Statements

BASIC supports If/ElseIf/Else blocks:
There is also a single-line format useful for quick tests:
For larger blocks of tests, a Select Case may be used:

### Looping Statements

BASIC sports a variety of looping constructs, including For/Next, Do/Loop, and While/Wend. The For statement may use either a numerical counter, or may iterate over the elements of an array using For Each.

### Output Statements

Most BASIC applications are visual (GUI) applications, and have no standard output. However, if one just needs to display a short message, the MsgBox statement may be used:
For debugging purposes, in REALbasic, you could also use System.DebugLog, which sends its argument to the standard debugging console for the platform you're on. In VB6, you can use Debug.Print to print a statement on the Immediate Window. In VB.NET, you can use the Debug object for various debugging options.

### Containers

BASIC includes supports for arrays, which may be passed as arguments, returned from functions, assigned to variables, and so on. There is also a Collection class, and in REALbasic, a Dictionary class which holds arbitrary key/value pairs.
In cases where none of these built-in containers are suitable, one can easily define a custom container class using whatever internal storage is most appropriate.

### Algorithms

Arrays of most primitive datatypes (e.g. numbers and strings) can be sorted (in VB.NET and REALbasic) or shuffled (REALbasic), as in this example:
The Dictionary class (in REALbasic) provides a built-in implementation of a resizable hash table. Other algorithms may of course be written by the user as needed.

### Garbage collection

BASIC uses reference counting rather than garbage collection. When there are no more references to an object or string, its memory is automatically (and immediately) released.

### Physical Structure

Visual Basic projects are made up of a variety of files, most of them plain text. REALbasic projects are usually stored in a single-file, proprietary binary format, though it is also possible to store project items externally, in either binary or XML format.

### Tips

Don't confuse Visual Basic with REALbasic and with classic BASIC (represented largely by Microsoft QuickBasic and QBASIC). They have common roots and similar syntax, but rather different semantics. REALbasic's semantics are closer to Java or VB.NET than to Visual Basic, which is more procedural than object-oriented.

### Web References

REALbasic Home Page REALbasic Garage VB Reference

### Printing

In the software Development concept Printing is very important one specially software development for business purpose
There are two types of printing
1) Windows printing 2) Dos printing

### Books and Articles

REALbasic developers should consider REALbasic Developer magazine.
Numerous books on both REALbasic and Visual Basic may be found via Amazon.com.