Skip to content

Template logic

Jorge Castro edited this page Apr 22, 2020 · 2 revisions

Template Logic

Tag Note
@if (boolean) if logic-conditional
@elseif (boolean) else if logic-conditional
@else else logic
@endif end if logic
@unless(boolean) execute block of code is boolean is false
@switch switch logic-conditional

switch / case

Example:(the indentation is not required)

@switch($countrySelected)
    @case(1)
        first country selected<br>
    @break
    @case(2)
        second country selected<br>
    @break
    @defaultcase()
        other country selected<br>
@endswitch()
  • @switch The first value is the variable to evaluate.
  • @case Indicates the value to compare. It should be run inside a @switch/@endswitch
  • @default (optional) If not case is the correct then the block of @defaultcase is evaluated.
  • @break Break the case
  • @endswitch End the switch.