# SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / How to detect odd or even numbers
 Register FAQ Members List Calendar Mark Forums Read

 27-02-2006, 11:40 AM #1 skywola Registered User     Join Date: Jan 2004 Location: Tempe, Arizona, USA Posts: 224 Thanks: 0 Thanked 0 Times in 0 Posts How to detect odd or even numbers How to Detect odd or even numbers in MEL int \$num = 1; if (\$num % 2 == 0) print(\$num + " even"); else print(\$num + " odd"); \$num++; __________________ "The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
 27-02-2006, 10:59 PM #2 MattTheMan Registered User     Join Date: Apr 2005 Location: Fairfield, CT Posts: 2,436 Thanks: 0 Thanked 18 Times in 18 Posts i dont know MEL, but I know C++, so: cant u divide a number by 2, then store the result in a char with 8 places, then scan the char, if the char has a dot in it then its odd, if not its even. __________________ Live the life you love, love the life you live
 28-02-2006, 04:06 AM #3 skywola Registered User     Join Date: Jan 2004 Location: Tempe, Arizona, USA Posts: 224 Thanks: 0 Thanked 0 Times in 0 Posts In MEL - no . . . . MEL is a much easier language than C++, although C++ undoubtably has more power, and more bells and whistles, so to speak. __________________ "The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
 28-02-2006, 08:00 AM #4 Alan Moderator     Join Date: Oct 2002 Location: London, UK Posts: 2,800 Thanks: 0 Thanked 5 Times in 5 Posts you've done it right by using the modulus command. If you get nothing back then it's even (i think! it's a bit early in the morning for maths! ) A __________________ Technical Director - Framestore Currently working on: Your Highness IMDB

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off

## \$34

Month-to-month billing
 \$34/month Unlimited access to all videos Project files to download Easy to cancel at anytime

## \$87

Billing every 3 months
 \$29/month Unlimited access to all videos Project files to download Easy to cancel at anytime Save \$5 per month or \$15 in total compared to monthly billing with this package.

## \$288

Billing every 12 months
 \$24/month Unlimited access to all videos Project files to download Easy to cancel at anytime Save \$10 per month or \$120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.