DEV Community

Sempare Limited
Sempare Limited

Posted on

1

Using the ternary expression in the Sempare Template Engine for Delphi

The Sempare Template Engine (available at https://github.com/sempare/sempare-delphi-template-engine and GetIt) is a versatile templating system designed specifically for Delphi developers to streamline the creation and management of dynamic HTML, text, or any other text-based output formats. Whether you are building web applications, reports, or email templates, the Sempare Template Engine offers a powerful yet straightforward solution that integrates with minimal boilerplate into Delphi projects. The template engine has been around since 2019 and has many features for you to explore.

Sometimes, you may want an inline ternary expression to simplify more verbose if-expressions.

e.g. You may have something like:

<% x := 123 %>
<% if x > 100 %>
   a big value
<% else %>
   a low value
<% end %>
Enter fullscreen mode Exit fullscreen mode

We could convert the above into:

<% x := 123 %>
<% print('a big value' if x > 100 else 'a low value') %>
Enter fullscreen mode Exit fullscreen mode

Conclusion

The above tutorial illustrated how a ternary expression could

The Sempare Template Engine is very flexible, configurable and extensible, allowing for a good seperation of concerns between your business logic that will access data, and the templating engine that will render/present your data as required.

The template engine is available on https://github.com/sempare/sempare-delphi-template-engine and via Embarcadero GetIt.

Sponsorship Required

Please help us maintain the project by supporting Sempare via GitHub sponsors (https://github.com/sponsors/sempare) or via our payment link (https://buy.stripe.com/aEU7t61N88pffQIdQQ). Sponsors can obtain access to our integrated IDE wizard for RAD Studio.

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • --last-failed: Zero in on just the tests that failed in your previous run
  • --only-changed: Test only the spec files you've modified in git
  • --repeat-each: Run tests multiple times to catch flaky behavior before it reaches production
  • --forbid-only: Prevent accidental test.only commits from breaking your CI pipeline
  • --ui --headed --workers 1: Debug visually with browser windows and sequential test execution

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Practical examples included!

Watch Video 📹ī¸

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

If this article connected with you, consider tapping ❤ī¸ or leaving a brief comment to share your thoughts!

Okay