Thursday, January 14, 2016

Variable Tutorial on Visual Basic .NET




Speak about programming certainly can not be separated from the variable.

What variable is?
A variable is something that can change.
I did not talk long about the types of variables here.
Books or on the internet many references about the various types of variables.
For simplicity I will use string and integer variables only.

eg.
      Dim sName as string
      sName = "Jhon Doe"

Or

Dim sName As String = "Jhon Doe"


String Variable

string variable is a variable that is used to store characters of letters or words.
Ex: Dim sName as string = "Jhon Doe"

The sName is a string variable
"Jhon Doe" is the content of the string variable.



Procedures for writing and a good naming variables:

Dim sName as string

- The variables that must either be easy to understand:

Ex: Dim iTheGreatestNumber as Integer


i = denotes integer
a combination of uppercase and lowercase facilitate the reading of variables.



Integer Variable

Integer type variables are variables that can store integer.

Ex: dim iNumber as Integer
        iNumber = 5

      or

Dim iNumber as Integer = 5

ok