Variables
Variables in VB are declared with the dimension keyword..
| Code |
Dim variable_name as string |
..also you will notice that after the "Dim", then the name there is an "as string" statement. This means that the variable that I declared is of variable type string. This is basically some text. Some other variable types include integer, double, currency, boolean, etc.
Conditionals
The IF statement can help you tell if the a value is equal to something, or not.
| Code |
Dim Number as integer |
Looping
If you want something to get done more than one time in visual basic, or any other programming language for that matter.. you will need to loop. There are different types of loops: DO WHILE, DO UNTIL and FOR.
| Code |
Dim current As Integer |
| Code |
Dim current As Integer |
You may think that there is not really any difference between the two loops above, but one fundamental difference is that the second loop will execute the code atleast once before the condition is checked.
The final loop is the FOR loop, and it goes a little something like this..
| Code |
Dim current As Integer |
..and thats it for the basics of Visual Basic! Enjoy!
discuss this topic to forum
