Variables

Variable plays an important role in computer programming. Every programming language are using variable to store temporary data and holds it until it is freed. By using a variable, you can use it one or more times even up to millionth times if it is necessary. Consider if you want to display the following string a millionth times: "The quick brown fox jumps over the lazy dog." You would need to type it 44 times over and over again to print the same result. But if you store it in a variable, all you need to do is call that variable and display the same result. Sound good, right? Example:
  1. Dim strValue as String
  2.  
  3. strValue = "The quick brown fox jumps over the lazy dog."
To display the value of a variable called "strValue" into a label named "label1", you'll do this like:
  1. Label1.text = strValue
Another example:
  1. Dim intValue as Integer
  2.  
  3. intValue = 9
  4. intValue = intValue + 2
In the example above, you are reusing the value of a variable called "intValue". There are so many useful example of a variable like using it in a Loop statement, but we will not discuss it here for simplicity reason. If you want to ask something, just leave your comment below.

Comments

Add new comment