Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Several Statements inside IF...ELSE... C/AL code

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Is there a way to ad more than one statement to an IF condition? I.E.

IF txtAccount = 'MAIN' THEN
{
    x = x + 1
    y = y + X
};


thats how I would do it in c# for example but I can't figure out how to do it in C/AL code. I have seen the documentation and I can't find that section.

*This post is locked for comments

  • Suresh Kulla Profile Picture
    Suresh Kulla 44,614 on at
    RE: Several Statements inside IF...ELSE... C/AL code

    Use BEGIN and END Statements to combine multiple statements instead of { } replace them with BEGIN END.

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 60,155 Super User 2025 Season 1 on at
    RE: Several Statements inside IF...ELSE... C/AL code

    IF txtAccount = 'MAIN' THEN BEGIN

       x = x + 1

       y = y + X

    END;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,309 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans