ASP Tutorials - Herong's Tutorial Examples - v5.10, by Dr. Herong Yang
Variables and Expressions in VBScript
This section provides tutorial examples on how to use variables and expressions in VBScript language.
Special rules about variables and expressions:
Here is a sample ASP page, variable.asp:
<script language="vbscript" runat="server"> ' variable.asp ' Copyright (c) 2002 by Dr. Herong Yang ' This program demonstrates some special rules about variables and ' expressions. ' response.write("<html><body>") response.write("<b>Tests on variables</b>:<br/>") i = 1 + 2 + 3 s = "Sum = " s = s & i & "<br/>" i = i=6 response.write(s) response.write("Is the answer correct? " & i) response.write("</body></html>") </script>
Output:
Tests on variables: Sum = 6 Is the answer correct? True
"i = i=6" is a very unusual statement. First of all, variable "i" has changed its data type from integer to Boolean. Secondly, two "=" signs are used next to each other, the first one is an assignment operation, and the second one is a Boolean equality operator.
Table of Contents
ASP (Active Server Pages) Introduction
IIS (Internet Information Services) 5.0
Mixing VBScript Statements with Static HTML Text
►Variables and Expressions in VBScript
"Collection" Class in VBScript
Managing Sessions with and without Cookies
scrrun.dll - Scripting Runtime DLL
Managing Response Header Lines
Calculation Speed and Response Time
Working with MS Access Database