Twig Templating for Friendly Frontend Devs
Including other Templates
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 1 / 1

Check out the following code:

{# source for homepage.twig #}

{{ include('_otherTemplate.twig', {'color': 'blue'}) }}
{# source for _otherTemplate.twig #}

{{ include('_thirdTemplate.twig', {
    'color': 'red',
    'number': 5
}) }}
{# source for _thirdTemplate.twig #}

{% set number = 10 %}

<h4>
    {{ color|default('green') }},
    {{ number|default(25) }},
    {{ name|default('Leanna') }},
    {{ food|default('tomato') }}
</h4>

Now, suppose that homepage.twig is rendered and passed a food variable set to pizza. What will be printed inside the h4 tag?

Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.