Video Course

Control Flow in Twig

by Ryan Irelan

The full run-down on the Control Flow options in Twig. Read the full description


Get immediate access to the course.
Secure checkout.

Start Watching for Free

What's in this Course?

In this course we will learn the fundamentals of control flow in Twig. We’ll learn what’s available to us to more carefully control how and when content is outputted in our Twig templates.

Control Flow is how we tell our program (or in our case templates) when and under which circumstances to process our statements. In Twig these statements could be including a new template, setting a variable, running macro, or using a Twig output tag to output something to the screen.


Here’s what we’ll cover in this course:

  • What Control Flow is and how we use it in our Twig templates
  • The two types of Control Flow
  • The Control Flow options available in Twig
  • How to use each Control Flow option in a basic way and more complex way.
  • How to simulate break in Twig
  • How to use the Continue and Break plugin for Craft CMS.

Craft Essentials Bundle

Get the entire Craft CMS learning path in some powerful package. This course plus 3 other make up everything you need to know to get started with Craft. It’s 60 videos and 8 hours of training.

Get Craft Essentials


What is the difficulty level?


This is an introductory-level Twig course. You should be a bit familiar with Twig code but a lot experience is not required. I created the course to help get better at building Twig templates. Where possible I kept this pure Twig but we do cover Craft-specific items toward the end of the course.

Do I need a Craft CMS to follow along?

For most of the course do not but it would make it easier to have Craft installed and running so you can easily create Twig templates and render them in the browser. You can download Craft for free. Run it on your localhost at and you can access all of the features without purchasing a license.

How many videos are there?

There are 14 videos in this course.

...and how long is each video?

The video times vary but the total course time is 1 hour and 15 minutes. About the same length as your favorite feature film.

What if I need to use them with my co-workers?

There is a Team Pack available, which allows you to share the screencasts with up to 5 people in your company or the Company license, which allows you to use the videos with up to 25 people. You can choose the proper license when you add the video series to your cart.

What if I have a suggestion?

We love feedback about our training materials. Please get in touch and let us know what you think.

Get in touch