break and continue are not available in Twig but we can use a third party plugin in Craft to make get the functionality we seek.
Here are all of the videos in Control Flow in Twig:
|1||Introduction||What we'll learn in this course.||01:23|
|2||What is Control Flow?||Before we learn the techniques, let's first learn what Control Flow is.||03:27|
|3||Two Types of Control Flow||The two types of Control Flow in Twig.||00:45|
|4||Choice - If||In Twig, we can use If to handle Choice control flow.||09:26|
|5||Choice - Available Operators in Twig||What operators can we use in our Twig conditionals?||03:16|
|6||Choice - Containment Operator||We look at how we can use the containment operator in Twig to check if a variable contains what we're looking for.||03:04|
|7||Choice - Test Operator||We use the Test Operator to check if a variable is what we think it is.||13:12|
|8||Choice - switch||The switch statement in Twig is only available in the Craft CMS. It's not part of core Twig.||07:05|
|9||Choice - Ternary Operator||When we want to make our conditionals compact or contained within another Twig tag (like an include tag), we can use the Ternary Operator in Twig.||10:51|
|10||Loops||We jump into the second type of Control Flow in Twig: Loops.||06:26|
|11||Loops - Adding a Conditional||We can make our loops a little smarter by adding a conditional to the statement.||01:32|
|12||Loops - Simulating break||Twig does not have the concept of break (or continue) while looping. But we can try to simulate it using built-in functionality. Are we successful?||06:50|
|13||Loops - Using break and continue plugin||break and continue are not available in Twig but we can use a third party plugin in Craft to make get the functionality we seek.||07:31|
|14||Wrapping Up||We wrap up the course by reviewing what we covered and a few words of encouragement!||00:57|
Invest in yourself, your career, and your ability to take knowledge and use it grow your business or earning potential.
Get everything in the catalog plus new videos every week. Just by signing up you get immediate access to hundreds of hours of learning.