The @if, @elseif and the @else tags allows you to write conditionals inside the Edge templates.

  • The @if and the @elseif tag accepts the expression to evaluate as the only argument.
  • Only the @if tag needs to be closed explicitly with the @end statement. Other tags must appear within the opening and closing if block.
<!-- Start if -->
<p> Hello {{ user.fullName }}! </p>
<p> Hello {{ user.firstName }}! </p>
<p> Hello Guest! </p>
<!-- End if -->

You can use the @unless tag in place of the @if tag to write an inverse if statement.

<p> Please verify the email address to activate your account </p>