1

I am new to using Laravel and am attempting to use my first if statement but unfortunately it throws an error:

Whoops, looks like something went wrong!

Code:

{{ @if($includes)
        good
   @else
        bad
}}

So I attempted to debug:

{{ @if(true)
        good
   @else
        bad
}}

then:

{{ @if(true === true)
        good
   @else
        bad
}}

All fail. What is it that I am doing wrong?

1 Answer 1

1

The blade directives do not need to be enclosed in braces. Remove the {{}}, those are needed only when you try to echo variables.

Also that should be in blade view files only.

@if(true === true)
        good
   @else
        bad
@endif
Sign up to request clarification or add additional context in comments.

1 Comment

I have just updated the answer to close the if statement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.