3.2.3 Variables

Source: Internet
Author: User

A variable is the amount of values that can be changed during the program running. A variable is usually used to represent the intermediate and final results of the stored program. Variables must be declared before use.

Variable declaration Syntax:
Dim variable name [As [New] data type] [= expression]
[As [New] data type] indicates the type of the variable. If it is omitted, the variable is of the Object type. [= Expression] returns the initial value of a variable, which can be omitted. For example, declare two variables intVar and strVar:
Dim intVar As Integer = 10' declares an Integer variable intVar and assigns the initial value 10.
Dim strVar As string' declares a String variable strVar
Multiple variables can be defined in a Dim statement. For example, declare that X is a long integer variable, Y is a single precision Floating Point variable, and Name is a string variable:
Dim X As Long, Y As Single, Name As String
The New keyword is used to create an object instance while declaring object variables. For details, see section 3.7.


BibliographyPrevious sectionNext section

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.