ASP Comparison Operators Logical Operators

來源:互聯網
上載者:User
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.

Operator English Example Result
+ Addition myNum = 3 + 4 myNum = 7
- Subtraction myNum = 4 - 1 myNum = 3
* Multiplication myNum = 3 * 2 myNum = 6
/ Division myNum = 9 / 3 myNum = 3
^ Exponential myNum = 2 ^ 4 myNum = 16
Mod Modulus myNum = 23 Mod 10 myNum = 3
- Negation myNum = -10 myNum = -10
\ Integer Division myNum = 9 \ 3 myNum = 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.

Operator English Example Result
= Equal To 4 = 3 False
< Less Than 4 < 3 False
> Greater Than 4 > 3 True
<= Less Than Or Equal To 4 <= 3 False
>= Greater Than Or Equal To 4 >= 3 True
<> Not Equal To 4 <>3 True
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.

Operator English Example Result
And Both Must be TRUE True and False False
Or One Must be TRUE True or False True
Not Flips Truth Value Not True False
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

Operator English Example Result
& String Concatenation string4 = "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.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.