Vbscript

Declaring Variables

Declaring Variables

Variables declaration is the same as variable creation because the computer is instructed to reserve the memory space. The variable can be named according to your preference. There may be short names such as a, b or c, or more authentic ones such as client, address, amount, etc. It is considered good programming practice to render clear and descriptive names of variables.

Rules for Declaring Variables −

  • The Variable Name should start with an alphabet.
  • The Variable names cannot surpass 255 characters.
  • The Variables must not include a period (.)
  • The Variable Names should be different in the stated context.

Using the "Dim" keyword, the variables are specified. Since just ONE basic data type is available, all variables specified are variants by default. Therefore, while declaring, a user does not declare the type of data.

Assigning Values to the Variables

Similar to an algebraic expression, values are assigned. On the left side of the variable name is followed by a symbol (=), and on the right side is the variable's value.

Rules for assigning the variables

  • The numeric values must be stated without double-quotes.
  • Date and Time variables must be confined within the hash symbol(#)
  • The String values must be confined within double quotes(")

Top course recommendations for you

    Python Basic Programs
    2 hrs
    Beginner
    42.1K+ Learners
    4.47  (2203)
    Ecommerce Website with HTML & CSS
    3 hrs
    Intermediate
    25.9K+ Learners
    4.55  (1035)
    Oracle SQL
    4 hrs
    Beginner
    39.8K+ Learners
    4.55  (2480)
    Java Basic Programs
    2 hrs
    Beginner
    34.9K+ Learners
    4.45  (1105)
    Excel Tips and Tricks
    1 hrs
    Beginner
    70.8K+ Learners
    4.55  (5117)
    Factorial Program in Python
    1 hrs
    Beginner
    3.1K+ Learners
    4.56  (97)
    Palindrome Program in C
    1 hrs
    Beginner
    3.3K+ Learners
    4.44  (144)
    PHP for Beginners
    2 hrs
    Beginner
    45.4K+ Learners
    4.52  (3348)
    Inferential Statistics
    1 hrs
    Beginner
    4.1K+ Learners
    4.54  (201)
    Catia Basics
    2 hrs
    Beginner
    18.1K+ Learners
    4.52  (1440)