# with

> Add variables for a section of a template.

`with` adds variables for a section of a template. They disappear at `endwith`.

page.kiln:

```kiln
{% with { heading: "Latest", items: posts|slice(0, 3) } %}
	<h2>{{ heading }}</h2>
	{% for item in items %}
		<p>{{ item.title }}</p>
	{% endfor %}
{% endwith %}
```

Output:

```html
<h2>Latest</h2>
<p>One</p>
<p>Two</p>
<p>Three</p>
```

The section can still read the variables around it. Variables you `set` inside it stay inside it.
