ASP Comparison Operators Logical Operators

http://www.tizag.com/aspTutorial/aspOperators.php

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值