SC04 - Conditions with IF & SWITCH

In our new course, we delve into the depths of the AE scripting world and familiarise ourselves with the powerful :IF and :SWITCH statements. You will learn how to implement conditional sequences in your scripts, discover when it makes sense to use them and what pitfalls you should avoid.

ℹ️ This Automic Course is part of PEM Automic and was published on January 22nd 2025.

📋 Content: 3 lessons and 1 final test

🕒 Duration: Depending on your experience as a designer, around 30 to 45 minutes.

In this course of our AE Scripting learning path, we will focus on two of the most important decision trees in the Automation Engine: the classic :IF and the versatile :SWITCH statement. Both make it possible to check conditions in scripts and execute different actions based on the results. The :IF is particularly suitable for simple, logical checks and nested conditions, while :SWITCH can be more efficient when evaluating several possible values.

The :IF statement is the workhorse of conditional logic in Automic. You can use it to check individual conditions and use :ELSE to create complex decision paths. By using logical operators such as OR, you can check for multiple comparison values simultaneously to make precise decisions. In addition, the nesting of :IF conditions allows you to build deeper logic structures into your scripts.

However, when you need to perform a simple value-versus-value check, the :SWITCH statement truly shines. Instead of using multiple :IF statements on the same value, :SWITCH is the ideal choice if you want to check a variable against a variety of values. With :CASE you can react to different values, and the :OTHER block ensures that a standard case is covered if none of the conditions apply. :SWITCH thus provides greater clarity when many options need to be checked. You can also check conditions in the :CASE statements.

By the end of this course, you will be comfortable using both structures and know when it makes more sense to use :IF or :SWITCH. With the help of practical examples and exercises, you will learn how to use these powerful tools efficiently in your automation scripts to create dynamic and flexible processes. Whether simple conditions or complex decision structures - with :IF and :SWITCH you are perfectly equipped!

Learn Automic with PEM!

Would you like to learn more about Automic without having to travel across the country for workshops? At PEM, you decide when and how you want to continue your education! In interactive courses, tutorials and videos, you will learn everything you need to know about Automic – and more! And we are always there for you via comment function or email.

Does that sound interesting? Then get started today with PEM, Automic Training 2.0 and year-round Automic support!

More about PEM
Get in touch

FAQ about Automic Training on PEM

PEM is the most innovative and fastest growing Automic learning platform. It offers PEM members a comprehensive range of online training courses that can be accessed 24/7 and from anywhere. The platform includes dozens of videos and interactive courses and is aimed at beginners and professionals alike.