Bird
0
0

Which of the following is the correct syntax to start a Blade conditional statement checking if $user->isAdmin() is true?

easy📝 Syntax Q3 of 15
Laravel - Views and Blade Templates
Which of the following is the correct syntax to start a Blade conditional statement checking if $user->isAdmin() is true?
A@condition($user->isAdmin())
B@if($user->isAdmin())
C@check($user->isAdmin())
D@when($user->isAdmin())
Step-by-Step Solution
Solution:
  1. Step 1: Recall Blade conditional syntax

    Blade uses @if to start conditional statements.
  2. Step 2: Match the correct directive with the condition

    @if followed by the condition in parentheses is the correct syntax.
  3. Final Answer:

    @if($user->isAdmin()) -> Option B
  4. Quick Check:

    Blade if syntax = @if(condition) [OK]
Quick Trick: Use @if(condition) to start conditionals in Blade [OK]
Common Mistakes:
  • Using non-existent directives like @condition
  • Forgetting parentheses after @if
  • Using @when or @check which are invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes