List of operators
Operators | Meaning | Default syntax |
---|---|---|
== |
Equal | operand == operand |
eq |
operand eq operand | |
!= |
Not Equal | operand != operand |
neq |
operand neq operand | |
< |
Less | number < number |
lt |
number lt number | |
<= |
Less than or Equal to | number <= number |
lte |
number lte number | |
>= |
Greater than or equal to | number >= number |
gte |
number gte number | |
> |
Greater | number > number |
gt |
number gt number | |
Functional Syntax | Operand operator ( Operand,Operand ) |
|
operand operator ( Operand operator Operand ) |
||
operand operator ( Operand operator ( Operand operator Operand )) |
- The two operands to be compared must be of the same type, either String or Boolean or Number.
- The operation can be nested in another operation that accepts operand type of boolean.
- The operands to be compared may be: An Blogger value, a data set, or the result of an Expression.
- Equality and inequality operators can also compare Array with the same type of the operand.
- When Operand type is String, it must be wrapped with DoubleQuote: "STRING".
Blogger Comparison Operator Example
Equal
<b:if cond='data:view.search.label == "foo"'> <!-- item --> </b:if>
Not Equal
<b:if cond='data:view.type != "item"'> <!-- item --> </b:if>
Less than or equal to
<b:includable id='post' var='post'> <b:if cond='data:post.numberOfComments lt 5'> <!-- item --> </b:if> </b:includable>
Nesting in Lamda
<b:with value='data:widgets.AdSense count (w => w.sectionId != "ads")' var='numMobileAds'> <!-- item --> </b:with>
With Logical Operator
<b:if cond='data:view.isMobile == "true" and data:view.isHomepage'> <!-- item --> </b:if>
Functional Operation
<b:if cond='data:blog.isMobileRequest == "true" and (data:blog.pageType == "index" and data:blog.url != data:blog.homepageUrl)'> <!-- item --> </b:if>