Web+ Tutorial

Previous

  Contents  

Next

Lesson 1.3 - Comparison Operators

Description
Comparison operators, also known as relational operators, are used to compare two operands. Comparison operators return either 0 (false), 1 (true), or null (if either operand is null). The following table lists the comparison operators available with Web+.
OperatorMeaning
=eqEqual to
=$eq$Equal to (non-case-sensitive)
ltLess than
gtGreater than
lteLess than or equal to
gteGreater than or equal to
!=neNot equal to
!=$ne$Not equal to (non-case-sensitive)
?Contains
!?Does not contain

Syntax
#operand1 operator operand2#
Example
#car =$ "Sedan"#
#age lte 21#
#balance != lowbalance#
#i / j = q ^ 6#
#D gt A#

Sample
<webIf #3 lt 8#>
3 is less than 8.
<webElse>
3 is not less than 8.
</webIf>
Result:
Exercise
Use the webIf statement to print a message stating whether 3 is less than 8.

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