web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to check if an integer is even or odd?

(0) ShareShare
ReportReport
Posted on by 428

Hi, is there any way to check if an integer is even or odd?

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    on at

    Hi, use the MOD 2 function to check if there's a remainder then it's odd if not it's even

  • Community Member Profile Picture
    on at

    If ( [tag:yournumber] MOD 2) = 0 then

      Message('even')

    Else

      Message('odd');

  • Verified answer
    Luc van Vugt Profile Picture
    on at

    Use the MOD operator.

    X MOD 2 will result in 0 or 1, when X is respectively even or odd.

    Funny is that the MOD operator is not (well) documented. But read some about it here www.mibuso.com/.../viewtopic.php

  • AbduTeeyech Profile Picture
    428 on at

    [int] mod 2 ==1 ??

  • Verified answer
    Community Member Profile Picture
    on at

    If ( #yournumber MOD 2) = 0 then

     Message('even')

    Else

     Message('odd');

  • AbduTeeyech Profile Picture
    428 on at

    Hi Youssef, thank you.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans