ASP
ASP intro
ASP basics
ASP variables
ASP operators

Programming

Programming intro
Java

Markup

First webpage guide
HTML
XHTML

Style & Layout

CSS

Browser scripting

Javascript
VBScript
AJAX

Server scripting

PHP

Making money online

Make money online

ASP operators

Operators have many purposes such as adding values, joining text strings, setting decisions on what code should be executed, and more.

This lesson focuses on:

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.

Operator Function Example Result
= Equal to 9 = 10 False
< Less than aNumber = 5, aNumber < 10 True
> Greater than aNumber = 5, aNumber > 10 False
<> Not equal to 5 <> 10 True

Logical operators

Logical operators take the result produced by comparison operators and compares them to create new true or false values. For example, true AND false = false.

Operator Function Example Result
AND True if both are true, otherwise false 9 = 10 AND 10 = 10 False
OR True if at least one is true, otherwise false 9 = 10 OR 10 = 10 True
Not Reverses truth value 5 = 5 False

String operators

There is only one string operator and that is the concatenation operator "&". This operator is used to combine text strings.

Example:

<%
Dim stringOne = "This is "
Dim stringTwo = "a text string"

Response.Write(stringOne & stringTwo & "<br />")
Response.Write("ASP stands for " & "Active " & " Server " & " Pages ")
%>

Output:

This is a text string
ASP stands for Active Server Pages

Practice

Online code editor
Practical examples
Practical exercises
Step-by-step tutorials

Reference

Terms glossary
Reference material

Rate this site

Rate this site
Visitor comments