Answers.Body: <p>There's only one comment syntax for Craft / Twig:</p>
  
  <pre><code>{# ... #}
  </code></pre>
  
  <p>Anything in between won't be parsed by Twig, so you can comment out multiple lines of Twig and HTML like so:</p>
  
  <pre><code>{# 
      {% set var = value %}
      {% for item in seq %}
          &lt;p&gt;{{ item }}&lt;/p&gt;
      {% endfor %}
  #}
  </code></pre>
  
  <p>As with many other languages you <strong>can't nest comments</strong>! So if you want to comment out some lines of code that already have comments, you can't do that like so:</p>
  
  <pre><code>{# 
      {#
       # Lots of comments going on here
       #}
      {% set var = value %}
  
      {# I warned you #}
      {% for item in seq %}
          &lt;p&gt;{{ item }}&lt;/p&gt;
      {% endfor %}
  #}
  </code></pre>
  
  <p>The best workaround I found is to use HTML comments in combination with Twigs <code>verbatim</code> tags (disables Twig parsing).
  I added a snippet to my editor for this and use it regularly since:</p>
  
  <pre><code>{% verbatim %}
  &lt;!--
      {#
       # Lots of comments going on here
       #}
      {% set var = value %}
  
      {# I warned you #}
      {% for item in seq %}
      {% endfor %}
  --&gt;
  {% endverbatim %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-05T16:06:56.447Z
Answers.Text: You should better comment out with Twig. HTML comments don't stop the Twig code from being executed, it just makes the HTML (that your Twig generates) not being rendered by the browser!
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-05T15:43:43.217Z
Answers.LastActivityDate: 2015-05-05T16:05:03.607Z
Answers.LastEditDate: 2015-05-05T16:05:03.607Z
Answers.UserDisplayName: carlcs
Body: <p>How do comments work in Craft? I mean inline and multiline comments, like:</p>
  
  <pre><code>HTML: &lt;!--xxx--&gt; m
    JS:   /*xxx*/  m   //xxx i
   PHP:   /*xxx*/  m   //xxx i   #xxx i
  </code></pre>
  
Tags: <templating><comments>
Title: Inline and multiline comments in Craft?
ThreadText: # Inline and multiline comments in Craft?
  
  (Asked by: username_0 on 2015-05-05)
  
  How do comments work in Craft? I mean inline and multiline comments, like:
  
  ```
  HTML: <!--xxx--> m
    JS:   /*xxx*/  m   //xxx i
   PHP:   /*xxx*/  m   //xxx i   #xxx i
  
  ```
  
  **Tags:** templating, comments
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-05-05. Score: 8 | Accepted answer
  
  There's only one comment syntax for Craft / Twig:
  
  ```
  {# ... #}
  
  ```
  
  Anything in between won't be parsed by Twig, so you can comment out multiple lines of Twig and HTML like so:
  
  ```
  {# 
      {% set var = value %}
      {% for item in seq %}
          <p>{{ item }}</p>
      {% endfor %}
  #}
  
  ```
  
  As with many other languages you **can't nest comments**! So if you want to comment out some lines of code that already have comments, you can't do that like so:
  
  ```
  {# 
      {#
       # Lots of comments going on here
       #}
      {% set var = value %}
  
      {# I warned you #}
      {% for item in seq %}
          <p>{{ item }}</p>
      {% endfor %}
  #}
  
  ```
  
  The best workaround I found is to use HTML comments in combination with Twigs `verbatim` tags (disables Twig parsing).
  I added a snippet to my editor for this and use it regularly since:
  
  ```
  {% verbatim %}
  <!--
      {#
       # Lots of comments going on here
       #}
      {% set var = value %}
  
      {# I warned you #}
      {% for item in seq %}
      {% endfor %}
  -->
  {% endverbatim %}
  
  ```
  
  > **Comments:**
  > **username_1**: You should better comment out with Twig. HTML comments don't stop the Twig code from being executed, it just makes the HTML (that your Twig generates) not being rendered by the browser!  
  
  ---
  
  