|
Web+ Tutorial
|
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+.
| Operator | Meaning |
|---|
| = | eq | Equal to | | =$ | eq$ | Equal to (non-case-sensitive) | | lt | Less than | | gt | Greater than | | lte | Less than or equal to | | gte | Greater than or equal to | | != | ne | Not 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.
|
|