VBScript is very flexible when it comes to storing data in variables. You can add variables that contain numbers together, or even concatenate strings. In ASP, we can group operators into four major categories: Arithmetic, Comparisons, Logic, and Concatenation.
The arithmetic operators used in ASP coding are very similar to other programming languages.
Comparison operators are often used within
Then blocks of code (conditional statements). They are helpful when you need to compare two variables and make a decision based on the outcome. The result of a comparison operator is either
|Less Than Or Equal To|
|Greater Than Or Equal To|
|Not Equal To|
A logical operator is used in conditional statements that require more than one set of
|All Must be ||True and False|
|One Must be ||True or False|
|Reverse of ||Not True|
When working with strings, the & operator is used to merge strings together to form a new string.
<!DOCTYPE html> <html> <head> <title>My Page</title> </head> <body> <% Dim x,y x = 5 + 1 y = 1 Response.Write (x & "<br />") If x > 1 Then Response.Write("x is greater than 1!<br />") Else Response.Write("x is not greater than 1!<br />") End If If (x > 1) And (y > 1) Then Response.Write("Both x and y are greater than 1!<br />") Else Response.Write("Either x or y is not greater than 1!<br />") End If Dim firstName Dim lastName Dim fullName firstName = "John" lastName = "Smith" fullName = firstName & " " & lastName Response.write(fullName) %> </body> </html>