• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15. Using ASP with JavaScript > Operators and Conditional Statements

Operators and Conditional Statements

You have to pay close attention to the operators in JavaScript and VBScript. Some are the same, and some are different. Critical differences can be found in the use of the assignment variable (=) in both assignment statements and conditional statements. Table 15.1 shows the operators used in VBScript.

Table 15.1. VBScript Operators
Operator Use Format Example
= Assignment inven=832
+ Addition total=item+tax+shipping
Subtraction discount=regPrice-salePrice
* Multiplication itemTotal=item * units
/ Division distrib=all/part
\ Integer division hack=433.33\32
Mod Modulus leftOvr = 87 Mod 6
u Exponentiation cube = side ^ 3
& Concatenation FullName = “Java” & “Script”
= Equal to if alpha = beta Then ….
<> Not equal to if Jack <> Jill Then ….
> Greater than if elephant > mouse Then ….
< Less than if subtotal < 85 Then ….
>= Greater than or equal to if counter >= sumNow Then ….
<= Less than or equal to if 300 <= fullAmount Then ….
Not Negation if not (alpha > beta) Then….
And Logical AND if (alpha > beta) And (delta < gamma) Then ….
Or Logical OR if (alpha=beta) Or (delta=gamma) Then….
Xor Logical XOR if (sum >=1000) Xor (tax > .08) Then….
Eqv Logical equivalence if (alpha = beta) Eqv (delta=gamma) Then….
Imp Logical implication if alpha Imp beta Then….



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint