Visual Basic, like any other programming language, employs special keywords known as commands. Unlike variables, which are named and defined within your code, command names are defined by the Visual Basic language itself and cannot be changed. Differences in the names and use of different commands are essentially what make one programming language different from another. As a programmer, you may be able to accomplish the same task coding in either C++ or Visual Basic, but the code involved would be drastically different between the two projects because of the way each language defines and interprets commands. In Visual Basic programming, the most basic commands—ones that you will use over and over in your projects—can be put into three categories: declarations, operators/math, and loops. Programming languages use commands called “declarations” to define and populate variables. Declarations can be a stumbling point for Visual Basic beginners because much of the syntax used is unique to Visual Basic. “Dim” (and “As”) is used to declare a variable. Examples: “dim MyString as string” or “n = dim n as integer.” “Static” is similar to what might be called a “global” in other languages; a “static” variable does not lose its assigned value until the entire program has been terminated. (I.e., it does not lose its value every time the particular procedure is ended.) “Public” defines a variable that can be used externally (i.e., by procedures other than the one in which it is created). OPERATORS AND MATH Basic math functionality falls under the “operators” category. Mathematical symbols such as “+”, “-”, “/” and “*” serve their usual purpose. Comparative operators such as “and” and “or” are also used the same as you’d see them in other languages. Other Visual Basic commands categorized as operators: “Eqv” performs a comparison against two logical variables. The command “Output = YesNoA eqv YesNoB” will set the variable Output “true” if both YesNoA and YesNoB are true. “Like” compares a string against a pattern. The command “Output = MyString like MyPattern” will return a “true” value to Output if MyString adheres to the pattern defined by MyPattern. LOOPS The basic use of loops and conditional arguments in Visual Basic programming is largely identical to other modern programming languages. The familiar “if/then/else,” “while” and “for each/next” arguments are all available for use in Visual Basic programming. “Wend” is used as an “end” command for a “while” loop in Visual Basic. Programmers familiar with languages where a “while” loop uses “end,” or languages limited to closing a “while” loop using parenthetical-type containers, will want to take note of the “wend” command. Writer Bio

Tutorial for Visual Basic Commands - 45