Documentation

If / Else statements

The If statement executes some code only if a specified condition is true.

Example:

<% if 1 = 2 then %> 
<p>I'm not sure you know how maths works.</p>
<% end if; %>

The If / Else statement executes some code if a condition is true and another block of code if the condition is false.

Example:

<% if 1 = 2 then %>
<p>I'm not sure you know how maths works.</p>
<% else %>
<p>Perhaps you get maths after all.</p>
<% end if; %>

For more information on conditionals and other control structures, check PostgreSQL documentation.