ASP Tutorials - Herong's Tutorial Examples - Version 5.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>
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.
Last update: 2003.
Table of Contents