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:
Output:
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!
Saurav Dhyani
Comments
Post a Comment