Skip to main content

🚀 Business Central 2025: Use the New "Continue" Keyword for AL Loops!

Hi Readers, 

Microsoft has just made AL loops easier to write! 🎉 With Business Central 2025 Release Wave 1, AL now supports the continue keyword, making it simpler to control loop iterations and improve code readability.

🔹 Why Is This a Big Deal?

Previously, AL only supported the break keyword, which completely stopped the loop. Now, continue lets you skip the current iteration and move directly to the next one—just like in C#, Java, and Python!

🔹 How Does the Continue Keyword Work in AL?

The continue keyword allows developers to bypass specific iterations in a loop while continuing the execution of subsequent ones. Here’s a basic example:


for i := 1 to 10 do begin if i mod 2 = 0 then continue; // Skip even numbers Message(Format(i)); // Will only print odd numbers end;

Output:

1 3 5 7 9

In this example, whenever i is even, the continue statement prevents the Message function from executing for that iteration, and the loop moves directly to the next number.



🔹 Where Can You Use the Continue Keyword?

You can use continue in all AL loops, including:
✅ For loops
✅ While loops
✅ Repeat-until loops

🔹 Important Considerations

âš  Name Conflict: If an object (like a method or field) is already named continue, the compiler will issue a warning but will still allow its use.

💡 Best Practice: Avoid naming AL members as continue to prevent confusion.

🔹 Why This Matters for Business Central Developers

🔹 Code Readability: Makes loops more intuitive and easier to understand.
🔹 Less Workarounds: No more manual skipping logic—just use continue.
🔹 Consistency with Other Languages: AL now behaves more like C# and Java.

🔹 Final Thoughts

This is a huge win for AL developers! The continue keyword will make your loops cleaner, more efficient, and easier to maintain.

📺 Want to see this feature in action? Check out my YouTube video for a complete walkthrough!

💬 What do you think about this new feature? Drop your thoughts in the comments below!

🔔 Stay updated with the latest Business Central features by following my blog and YouTube channel!

 Regards,
 Saurav Dhyani

Comments

Popular posts from this blog

RTC Report It is not possible to instantiate the Visual Studio bridge.

Hi all, As a Navision developers I have Multiple Versions of Navision running in single Machine. As discussed Earlier in the post how to run multiple Version of RTC in single machine. So my machine have following details for RTC Versions - NAV 2009 R2    - is installed. NAV 2009 SP1  - is copied at C:\Program Files (x86)\Microsoft Dynamics NAV\60\NAV 6.0 SP1 IN\ NAV 2009         - is copied at C:\Program Files (x86)\Microsoft Dynamics NAV\60\NAV 6.0 IN\ This approach has been working great for execution of Classic and RTC Clients. However, after installing Dynamics NAV 2009 R2, if i tried to view the Layout for an NAV 2009 SP1 Report i was getting the following error: ---------------------------  Microsoft Dynamics NAV Classic  ---------------------------  It is not possible to instantiate  the Visual Studio bridge.  ---------------------------  OK    --------------------------- After searchi...

Dynamics NAV - All that you need to know about MenuSuites.

Hi Readers, This article is based on a request from a blog reader who wanted to understand about MenuSuite in Dynamics NAV. If you have started working with Business central with AL Code then it does not apply to those releases but if you are interested go ahead. Let's start with Future - In Latest and greatest version of product MenuSuite are obsolete and no longer used. So this article applies if you want to learn about C/AL MenuSuite.

NAV 2013 R2 - Cumulative update 12 Released.

Hi all, Please find below the details of  Cumulative Update 12 released for Microsoft Dynamics NAV 2013 R2. Title - Cumulative Update 12 for Microsoft Dynamics NAV 2013 R2 Build No. - 38053 Release Date - October, 2014 Local Version Included - AU, AT, BE, CH, DE, DK, ES, FI, FR, IS, IT, NA, NL, NO, NZ, SE, UK, RU Download Link Note: Implementing this cumulative update will require a database conversion unless you have already implemented update rollup 5.