PebbleTemplates / pebble

Java Template Engine
https://pebbletemplates.io
BSD 3-Clause "New" or "Revised" License
1.1k stars 168 forks source link

Boolean operator with objects #668

Open tobiascapin opened 10 months ago

tobiascapin commented 10 months ago

Hello, I'm migrating my templates from another java library derived from Twig syntax. I have some troubles with implicit boolean expressions, I cannot understand very well why this expression works:

{% if myobj %}

and why this doesn't work

{% if not myobj %}

I know it can be replaced by {% if myobj is empty %} but since the first works, make it sense to not use the "not"?