Page 197 - DCAP408_WEB_PROGRAMMING
P. 197
Unit 7: Introduction to ASP (Active Server Pages)
To illustrate what I mean, if you had a page that read: Notes
<%
Pi = 3.141592654
Response.Write Pi
%>
This is a perfectly valid page. You will get the value of Pi written back to the page, as you really
expected.
Now, using the Option Explicit directive as above, let’s rewrite the same page as follows:
<%
Option Explicit
Dim Pi
Pi = 3.141592654
%>
Did u know? What are the uses of session variables?
Session variables are used to store information about ONE single user, and are available
to all pages in one application. Typically information stored in session variables are
name, id, and preferences.
Self Assessment
Fill in the blanks:
9. No scripts outside the procedure can access or change the .............................
10. A variable declared outside a ............................. can be accessed and changed by any script
in the ASP file.
7.4 ASP Operators
Arithmetic Operators
Arithmetic operators are used to perform mathematical calculations.
Operator Function Example Result
+ Addition aNumber = 2 + 2 aNumber = 4
- Subtraction aNumber = 4 - 2 aNumber = 2
* Multiplication aNumber = 10 * 10 aNumber = 100
/ Division aNumber = 32 / 4 aNumber = 8
Comparison Operators
Comparison operators are used to compare two values and make a decision. Comparison
operators return a true or false value.
LOVELY PROFESSIONAL UNIVERSITY 191