 # ASP Operators

ASP is programmed in VBScript by default, thus ASP's operators are VBScript operators by default.

Operators in ASP fall into four categories Math, Comparisons, the somewhat more advanced Logic operators, and Leftovers(those that don't fit well into any category).

# ASP Arithmetic Operators

The mathematical operators in ASP are similar to many other programming languages. However, ASP does not support shortcut operators like ++, --, +=, etc.

OperatorEnglishExampleResult
+AdditionmyNum = 3 + 4myNum = 7
-SubtractionmyNum = 4 - 1myNum = 3
*MultiplicationmyNum = 3 * 2myNum = 6
/DivisionmyNum = 9 / 3myNum = 3
^ExponentialmyNum = 2 ^ 4myNum = 16
ModModulusmyNum = 23 Mod 10myNum = 3
-NegationmyNum = -10myNum = -10
\Integer DivisionmyNum = 9 \ 3myNum = 3

# Comparison Operators

Comparison operators are used when you want to compare two values to make a decision. Comparison operators are most commonly used in conjunction with "If...Then" and "While something is true do this..." statements, otherwise known as conditional statements. The items that are most often compared are numbers. The result of a comparison operator is either TRUE or FALSE.

OperatorEnglishExampleResult
=Equal To4 = 3False
<Less Than4 < 3False
>Greater Than4 > 3True
<=Less Than Or Equal To4 <= 3False
>=Greater Than Or Equal To4 >= 3True
<>Not Equal To4 <>3True

# Logical Operators

The above comparison operators result in a truth value of TRUE or FALSE. A logical operator is used for complex statements that must make decisions based on one or more of these truth values.

OperatorEnglishExampleResult
AndBoth Must be TRUETrue and FalseFalse
OrOne Must be TRUETrue or FalseTrue
NotFlips Truth ValueNot TrueFalse

# String Operators

The only string operator is the string concatenation operator "&" that takes two strings and slams them together to form a new string. An example would be string1 = "Tim" and string2 = " is a Hero". The following code would combine these two strings into one: string3 = string1 & string2

OperatorEnglishExampleResult
&String Concatenationstring4 = "Bob" & " runs"string4 = "Bob runs"

We will be using these operators throughout the tutorial, so chances are you will get understand them more and more as this tutorial goes on.

# Found Something Wrong in this Lesson?

Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time!

 Web Reference HTML Reference CSS Reference CSS Examples PHP Examples Help Tizag Grow Link to Tizag Tizag.com Store
 Advertise Here More Tutorials! Microsoft Office Tutorials Artist Tutorials