Variables

Submitted by: 

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

pls wat does the + 2 implies

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.