Eval Function | Execute Statement | Executeglobal Statement Usage _asp Basics

Source: Internet
Author: User
Tags eval

Eval function

Evaluates the value of an expression and returns the result.

 [result = ]Eval(expression)

Parameters

Result

Options available. is a variable that accepts the returned results. If you do not specify a result, you should consider using the Execute statement instead.

Expression

Required option. Can be a string that contains any valid VBScript expression.

Description

In VBScript,x = y can be interpreted in two ways. The first method is an assignment statement that assigns the value of y to x. The second explanation is to test whether x and y are equal. If equal, result is True, otherwise result is False. The Eval method always takes the second explanation, and the Execute statement always takes the first one.

Note This comparison is not confused with assignment in Microsoft (R) Visual Basic scripting Edition because the assignment operator (=) differs from the comparison operator (= =).

Execute statement

Executes one or more of the specified statements.

Execute statements

The required Statements parameter is a string expression that contains one or more statements to execute. If you want to include more than one statement in the statements parameter, you should separate it with a semicolon or an embedded branch.

Description

In VBScript,x = y can be interpreted in two ways. The first is to assign the value of y to xas an assignment statement. Second, as an expression, test whether the values of x and y are equal. If equal, the result is True, otherwise the result is False. The Execute statement always uses the first explanation, and the Eval method always uses the second.

Note There is no confusion between assignment and comparison in Microsoft (R) Visual Basic scripting Edition, because the assignment operator (=) is different from the comparison operator (= =).

The context in which the Execute statement is invoked determines the objects and variables that can be used by the code to be run. The objects and variables within the scope are available to code that is running in the Execute statement. However, it must be understood that if the code being executed creates a procedure, then the procedure will not inherit the scope of the procedure in which it resides.

Like other processes, the scope of the new process is global, and it inherits everything from the global scope. Unlike other procedures, its context is not a global scope, so it can only be executed within the context of the procedure in which the execute statement occurred. However, if the same Execute statement is invoked outside of the procedure, such as in the scope of the global scope, it will not only inherit everything in the global scope, but it can also be invoked anywhere, because its context is global.

Executeglobal statement

Executes a function multiple statements specified in the script global namespace.

ExecuteGlobal statement

The statement parameter is a string expression that contains one or more executable statements. You can include more than one statement in the statement parameter, separating it with a colon.

Description

In VBScript, x = y can be interpreted in two ways. The first method is to assign a value of y to xas an assignment statement. The second method is an expression that tests whether x and y have the same value. If they are equal, the result is True; If they are not equal, the result is False. The executeglobal statement always uses the first method, and the Eval method always uses the second method.

Note There is no confusion between assignment and comparison in Microsoft (R) Visual Basic scripting Edition, because the assignment operator (=) is different from the comparison operator (= =).

In the global namespace of the script, all the statements inExecuteglobal are executable. Therefore, you are allowed to add code to your program so that any process can access it. For example, a VBScript Class statement can be executed at run time. A new instance of this class is created with the function.

Adding procedures and classes at run time is useful, but it can also result in overwriting existing global variables and functions at run time. Because this can cause very serious procedural problems, you must be very cautious when using the executeglobal statement. If you do not need to access a variable or function other than the procedure, it is best to use the Execute statement, because it affects only the namespace of the keynote function.

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.