How can I escape Twig code to prevent it from being parsed? How do I escape Twig code to prevent it from being processed?
Escape single lines as strings:

{{ '{% set foo = "bar" %}' }}

Use autoescape to escape multiple lines, optionally specifying a syntax (see docs):

{% autoescape %}
     {% if foo != "bar" %}
         {% set foo = "bar" %}
     {% endif %}
{% endautoescape %}

Use verbatim to treat multiple lines as raw text:

{% verbatim %}
     {% if foo != "bar" %}
         {% set foo = "bar" %}
     {% endif %}   
{% endverbatim %}