For those of us who have been working with AL language for a long time, there’s always been one small but powerful feature we’ve been waiting forβthe “continue” statement! Well, with the release of Dynamics 365 Business Central 2025 Wave 1 (v26), it’s finally here! π
What is the “Continue” Statement?
The “continue” statement is used inside loops to skip the rest of the current iteration and move directly to the next iteration of the loop. This means that when a continue is encountered, any remaining code in that iteration is ignored, and the loop immediately jumps to the next cycle.
Why is This Important?
Before BC26, if we wanted to skip specific iterations in a loop, we had to rely on complex if conditions or nested loops, making the code harder to read. Now, we can simply use continue, making our AL code much cleaner and more efficient!
How Does It Work? (Examples)
1. Skipping Even Numbers in a Loop
Letβs say we want to process numbers from 1 to 10, but we want to skip even numbers. Previously, we would have used an if condition to avoid executing the rest of the loop. Now, itβs much simpler:
procedure SkipEvenNumbers()
var
i: Integer;
begin
for i := 1 to 10 do begin
if i mod 2 = 0 then
continue; // Skips even numbers
Message('Processing number: %1', i);
end;
end;Output:
Processing number: 1
Processing number: 3
Processing number: 5
Processing number: 7
Processing number: 9(Even numbers are skipped!)
Whatβs Still Not Working?
While the “continue” statement is fully functional, IntelliSense does not yet recognize it when typing cont… in Visual Studio Code. This might be a temporary issue in the current preview version of the VS Code extension for Business Central. Hopefully, in the final release, IntelliSense will properly suggest it. However, the “continue” statement is already usable and works perfectly in compiled code! π
Final Thoughts
As a Business Central developer, I have waited for this feature for a long time, and now that itβs here in BC26, Iβm excited to start using it in my code! π This small but mighty addition to AL makes loops cleaner, more readable, and more efficient.
πΉ What do you think? Are you happy about the continue statement finally arriving in Business Central? Letβs discuss in the comments! π