Blogger Logical Operator Syntax
Operator | Meaning | Default syntax |
---|---|---|
and |
AND | boolean && boolean |
&& |
boolean and boolean | |
or |
OR | boolean || boolean |
|| |
boolean or boolean | |
not |
Is not | !boolean |
! | not boolean | |
Functional Syntax | Operand operator ( Operand,Operand ) |
|
Operand operator ( Operand operator Operand ) |
||
Operand operator ( Operand operator ( Operand operator Operand )) |
- The result of the operation will always be a Boolean value.
- The operands must be of type boolean and can be: An Blogger value, a data set or the result of an Blogger Expression.
- A non-Boolean data is considered
false
when it is empty andtrue
when it contains a content.
Blogger Logical Operator [and]
The "and
" operator returns a true
value when all operands are true
. When one of the operands returns value is false
, the result will be false
.Blogger Logical Operator [or]
The "or
" operator returns a true
when one of the operands is true
. When all operands return value is false
, the result will be false
.Blogger Logical Operator [not]
The operator "not
" mean to reverse the value of the operand. true
becomes false
, and vice versa. Also, the operator "not
" can be combined with membership operator .not in
not contains
Blogger Logical Operation Example
The operator "AND"
<b:if cond='data:view.isMobile and data:view.isHomepage'> <!-- item --> </b:if>
The operator "OR"
<b:if cond='data:view.isLabelSearch or data:view.isHomepage'> <!-- item --> </b:if>
The operator "NOT"
<b:if cond='!data:view.isMobile'> <!-- item --> </b:if>
Nesting in a Comparison operation
<b:if cond='data:blog.pageType == "item" or data:blog.pageType == "index"'> <!-- item --> </b:if>
Nesting in a Lambda operation
<b:eval expr='data:posts count (p => p.labels.any and p.title)'/>
Functional Operation
<b:if cond='data:blog.pageType == "archive" or (data:blog.pageType == "index" and data:blog.url != data:blog.homepageUrl)'> <!-- item --> </b:if>