Search here for all the info you want in this Blog

VBScript Statements

VBScript Statements


q A Statement is a basic execution unit of VBScript source code. A statement tells the computer to perform a piece of work. For example, a declaration statement declares a variable. An assignment statement assigns a value to a variable.
q Here are some general rules about VBScript statements:
* Each statement must have a statement keyword to identify the type of the statement. But there is one exception, the "Call" keyword of the function call statement is optional. For example, "Dim" is the keyword to identify a variable declaration statement. "document.writeln(...)" is call statement.
* One line can not have more than one statement. For example, "Dim price=9.99" is not a valid statement. "x=1, y=2" is not a valid statement.
* One statement is usually written in one line. But if you want to continue a statement on the second line, you must put (_) at the end of the first line like this:
                                    statement_part_1
                                     _ statement_part_2
* Comments can be entered at the end of a statement proceeded with (') like this: statement ' comment
* Statement keywords are case insensitive. For example, "Dim" and "DIM" are the same keyword.
q Like any other generic programming language, VBScript offers a number of statement types. I will only list some commonly used statement types below:

q "=" (Assignment) Statement - Assigning values to variables. For example:

q author = "Herong"
q price = 9.99

q "Call" Statement - Calling a function or a subroutine. For example:

q Call document.writeln("Hello world!")

q "Dim" (Declaration) Statement - Declaring variables. For example:

q Dim Author, Title, Size
q Dim Price

No comments:

Post a Comment