and

Reports whether the piped value and its argument are both truthy, reading truthiness the way a template `if` does.

It is what lets one condition be written as one expression, so {{ enabled | and:has_rows }} replaces a nested pair of if blocks.

A nil value is refused rather than read as false, since a flag that was never set and a flag whose path was misspelled look the same by the time they get here. Put a default ahead of it to say what absence means. An argument naming a variable that does not exist fails for its own reason, since the template asked for something the data was never going to hold. Both operands are evaluated, because an argument is resolved before the modifier runs, so there is no short circuit to lean on.

InputArgumentsReturnsanyanybool
Source
BasicSource

Combines two conditions into one expression, so a template needs no nested if blocks to ask whether both hold.

Given

{"enabled": true, "has_rows": true}

Template

{{ enabled | and:has_rows }}

Result

true
AbsentSource

Reads a value that was never set as false, so the condition answers rather than failing the render.

Given

{"has_rows": true}

Template

{{ enabled | default:false | and:has_rows }}

Result

false