Conditionals
A conditional within a template creates a decision path. The engine will consider the conditional and choose from two or more potential blocks of code. There is always a minimum of two: a path if the conditional is met (evaluated as true), and either an explicitly defined else path if the conditional is not met (evaluated as false), or alternatively, an implied else path consisting of an empty block.
The statement for conditionals is the if statement. This statement works much the same as it does in Python. An if statement can be combined with one or more optional elif with an optional final else, and unlike Python, requires an explicit endif. The following example shows a config file template snippet combining both regular variable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access