Web+ Tutorial

Previous

  Contents  

Next

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+.
OperatorMeaning
&& AndAnd
! NotNot (logical opposite of operand)
|| OrOr
? LikeContains
!? NotLikeDoes 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.

Previous

  Contents  

Next

 

Copyright © 2009 Webplus, Inc. (talentsoft). All Rights Reserved.
webmaster@webplus.com