Conditionals

Table of Contents

Edge has first-class support for conditionals via if and unless tags.

if

@if(username)
  <h2> Hello username </h2>
@endif

if/elseif

@if(hours < 12)
  <h2> Good morning </h2>
@elseif(hours < 18)
  <h2> Good afternoon </h2>
@endif

if/else

@if(hours < 12)
  <h2> Good morning </h2>
@elseif(hours < 18)
  <h2> Good afternoon </h2>
@else
  <h2> Good evening </h2>
@endif

unless

The unless tag is opposite of the if tag.

@unless(username)
  <h2> You are not loggedin </h2>
@else
  <h2> Hello {{ username }} </h2>
@endunless