Bird
0
0

Identify the error in this Blade template snippet:

medium📝 Debug Q6 of 15
Laravel - Views and Blade Templates
Identify the error in this Blade template snippet:
@if($user->name)
Welcome, {{ $user->name }}
@endif
@else
Please log in
AMissing closing @endif
BThe @else is outside the @if block
CIncorrect variable syntax
DNo error
Step-by-Step Solution
Solution:
  1. Step 1: Check Blade conditional structure

    @else must be inside the @if ... @endif block.
  2. Step 2: Locate @else placement

    Here, @else is placed after @endif, which is invalid.
  3. Final Answer:

    The @else is outside the @if block -> Option B
  4. Quick Check:

    Blade @else must be inside @if [OK]
Quick Trick: @else must be inside @if ... @endif [OK]
Common Mistakes:
  • Placing @else after @endif
  • Forgetting to close @if
  • Using wrong variable syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes