Grasshopper

generative modeling for Rhino

Is there a way to find if a number is ODD or EVEN?

I mean if I have an output number and its 6, is there a function that could say: Yes its even then TRUE...

Thanks
Maurice

Tags: EVEN, NUMBERS

Views: 176

Reply to This

Replies to This Discussion

Try this expression: x % 2 = 0

The "%" is "modulus" (there's also a modulus component...) which returns any remainder when x is divided by 2.

You'll have to watch out for zero which is neither even or odd, but with the above expression it comes out as an even number.

Thanks a lot TAZ
Thanks Taz, very helpful !

added to my favourite expressions!

 

Thank you!

 

DeDackel

RSS

Translate

Search Grasshopper

Members

Photos

  • Add Photos
  • View All

© 2012   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service