|
|
The Building Blocks of a Programming LanguageTraditional programming languages are composed of commands (often called statements), operators, variables and data. Variables represent data and the statements and operators operate on the data to produce the required output.VariablesLocal VariablesThe concept of local and global variables is of utmost importance. Local variables are range-limited variables. That means that they have a limited lifespan. They work and live only in the function where they are defined. As soon as the function cycle ends, these variables lose their value. Global VariablesContrary to local variables, global variables live throughout the program. They are valid in all sub-programs that the main program calls. The most natural question that one would ask. Why do we need the local variables in the first place. Lets all define all variables as global variables. this might work for small programs. But when you go on to build huge application that involves numerous sub-routines, you don't know which variable has what value in which function. In short, its total chaos. Constants Constants are similar to variables but only have a single value throughout the execution of a program. The contents of variables can change as often as necessary. So why use a constant if it can only hold one value? Well often in a program it is necessary to use the same number or string repeatedly. For example, in a program to calculate end of year accounts there will be several parts of the program referring to the current value of salary. We could hard code the value into the program everywhere it is used, but it would be tedious to change if the government altered the rate. Alternatively we could use a standard variable called 'sal' to hold the value. So if there is a change required in the salary, we don't have to change the value everywhere in the program.
Arrays Arrays are one of the most important structures in any programming language. In simple terms, arrays can be defined as group of similar data types. When large number of similar data has to be processed, one cannot find a better way of implementation than arrays.OperatorsMathematical Operators+, -, *, /, %, etc are the mathematical operators Boolean OperatorsAND, OR, NOT, Ex-OR, NAND, etc are boolean operators. Also known as Logical operators. Programming language also contains numerous other aspects like functions, procedures, dynamic data types like link lists, binary trees, stacks, queues, etc. Also if you go deep, then you have to consider the compiler directives, preprocessor, linker, etc. All these are beyond the scope of my articles. Also Go To Page: 1 2
The copyright of the article Building Blocks in Learning Visual Basic is owned by . Permission to republish Building Blocks in print or online must be granted by the author in writing.
|
|
|
|
|
|
|
|