|
Web+ Tutorial
|
Lesson 1.5 - Logical Operators
Web+ provides a set of operators you can use to build logical equations. Each of these operators returns 1 (true) or 0 (false). By the end of this lesson, you will learn how to perform logical operations in Web+.
- Description
- The following table lists the logical operators available with Web+.
| Operator | Meaning | | && And | And | | ! Not | Not (logical opposite of operand) | | || Or | Or | | ? Like | Contains | | !? NotLike | Does not contain |
- Syntax
#expression1 operator expression2#
- Example
#(A lt B) && (C gt D)# #(sales gt 5000) || (hoursWorked gt 81)# #"PC" != "pc"# #(A = B) And (D = F) Or (L = M)# #submit ? "delete"#
- Sample
<webSet #num1# = 4> <webSet #num2# = 8> <webSet #num3# = 2> <webIf #(num1 Gt num2) And (num1 Gt num3)#> <webPrint>#num1#</webPrint> is the highest. <webElseIf #(num2 Gt num1) And (num2 Gt num3)#> <webPrint>#num2#</webPrint> is the highest. <webElseIf #(num3 Gt num1) And (num3 Gt num2)#> <webPrint>#num3#</webPrint> is the highest. </webIf>
- Result:
- Exercise
-
You can try out some Web+ code of your own here.
|
|