Elements Language Comment Statement

It would be useful to have a comment feature added to the Elements Language, for example:

@@ This is a comment about the code below!
@if(switch)
<div>This is a Div</div>
@endif

I am not clear whether you can add comments to @if, @endif etc ? :slightly_smiling_face:

Maybe I’m missing something… but why not just use HTML comments?

<!-- This is an HTML comment about the code below! -->
@if(switch)
  <div>This is a Div</div>
@endif

@dan ,
Yes you can but then it gets output with the HTML. I was looking not to have the comment published to the website. I could hid a comment with PHP but seems somewhat counter-intuitive?

You could use an if statement for now. It’s not as elegant as a comment but it’ll work.

@if(comment) This is an HTML comment about the code below! @endif
@if(switch)
  <div>This is a Div</div>
@endif

Because the comment property doesn’t exist, it’ll evaluate to false and never output the comment text.

you could also check if you’re in edit mode:

@if(edit)
  <!-- This is my comment for edit mode only -->
@endif