Logic5 min read•Audience: Developers, Marketers
If / Else Logic & Comparisons
Use built-in comparison helpers (eq, gt, lt, contains) to render branching email variations.
Key Takeaways
- Render alternative content when a condition fails using {{else}}.
- Use comparison helpers: (eq a b), (gt a b), (lt a b), (contains list item).
- Create personalized loyalty tier messaging, localized currency blocks, and shipment status alerts.
PostBrix Comparison Helpers#
PostBrix includes built-in comparison helpers registered in the email engine:
Multi-Branch (Else If) Logic#
For multi-tier membership or status workflows, chain branches using {{else if ...}}:
code
handlebars
This eliminates the need for separate email templates for each customer segment.
Frequently Asked Questions
Are string comparisons case-sensitive in the eq helper?
Yes. (eq tier "gold") will match "gold" but not "Gold". Ensure input data is normalized to lowercase on your server.
Can I compare dates with the gt or lt helpers?
If dates are formatted as ISO 8601 strings (e.g., "2026-10-15T00:00:00Z"), lexicographical string comparison works reliably with gt and lt.