From 4722542caf4192fe702adc975e8ee557e3526426 Mon Sep 17 00:00:00 2001 From: frosty Date: Thu, 12 Mar 2026 18:13:04 -0400 Subject: feature: added conditionals + added examples --- examples/template-demo/templates/index.html | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'examples/template-demo/templates') diff --git a/examples/template-demo/templates/index.html b/examples/template-demo/templates/index.html index 837688f..2a08485 100644 --- a/examples/template-demo/templates/index.html +++ b/examples/template-demo/templates/index.html @@ -40,6 +40,55 @@ {{endfor}} +

Conditional Statements (if/elif/else)

+ +

Simple truthy check

+

+ {{if user_logged_in}} + User is logged in! + {{else}} + User is NOT logged in. + {{endif}} +

+ +

Equality check (role == "admin")

+

+ {{if role == "admin"}} + Welcome, Admin! You have full access. + {{elif role == "user"}} + Welcome, User! You have standard access. + {{else}} + Welcome, Guest! You have limited access. + {{endif}} +

+ +

Not equal check (status != "inactive")

+

+ {{if status != "inactive"}} + Account is active. + {{else}} + Account is inactive. + {{endif}} +

+ +

Variable existence check (exists)

+

+ {{if exists username}} + Username exists! + {{else}} + Username does NOT exist. + {{endif}} +

+ +

Variable existence check (not exists)

+

+ {{if not exists missing_var}} + missing_var does NOT exist (as expected) + {{else}} + missing_var exists (unexpected!) + {{endif}} +

+ -- cgit v1.2.3