Home > Visual Basic.Net > Declaring Variables In Visual Basic.Net

Declaring Variables In Visual Basic.Net

Variables in VB.Net are declared using this stereotypical programming format.

1.) The language must be told that you are declaring a variable.
2.) The name of the variable must be given.
3.) The variable type must be set.

In a language such as AS3 the code would look like this:

var myVar:String

In visual basic, as it is intended to be a language for beginners, the code would look like this:

dim myVar as String

In visual basic, the word var is unused and is replaced by dim. Why dim is used is have no idea.

However, you will notice that the colon in AS3 is replaced by as .

This is the beauty of learning Visual Basic.Net as a first programming language. If you know to replace the word dim with declare, and you know that a string is text.

This line of code is written in Pure English.

declare myVariable as text

You don’t need to be an expert to understand this. Do ya’?

This is the case with a lot of VB.Net code and is a reason why a lot of people opt to learn this language before moving on to more complex languages such as PHP or C++

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Twitter
Categories: Visual Basic.Net Tags:
  1. No comments yet.
  1. No trackbacks yet.