Vbs Tutorial: VBScript statement-public statement

Source: Internet
Author: User

Public Statement

Define public variables and allocate buckets. InClassBlock to define private variables.

PublicVarname [([subscripts])] [, varname [([subscripts])]...

Parameters

Varname

The variable name follows the naming conventions of standard variables.

Subscripts

The dimension of the array variable. up to 60-dimensional arrays can be declared.SubscriptsThe parameters use the following syntax:

Upper [,Upper]...

The lower bound of the array is always 0.

Description

Public Statement variables can be used in all processes in all scripts.

You must useSetStatement to assign an existing object to the variable. Before assigning values, the declared object variable is initialized to empty.

It can also contain parentheses.PublicStatement to declare a dynamic array. After declaring a dynamic array, you can useRedimStatement to define the dimension and element of the array. If you try to re-declare the dimension of the array variable, and the size of the array variable is already in the private,PublicOrDimWhen explicitly specified in the statement, an error occurs.

The following example illustrates how to usePublicStatement:

 
PublicMynumber 'public variant variable.PublicMyarray (9) 'Public array variable. 'multiple public declarations of variant variables.PublicMynumber, myvar, yournumber

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.