
Odd or even numbers

pavpav
✭
in RobotStudio
Hi
I would like to check if a value is odd or even, does anyone have a good solution for this in RAPID?
I know its possible to divide a value by 2 and count the amount of decimals, but i cannot find a function that can count decimals.
Thank you
0
Comments
-
Check out "MOD" -- IF nYourNumber MOD 2 = 0 THEN
0 -
As an extention of Soup his answer, check out this page to understand the mathematics behind the MOD instruction:It explains fairly well what MOD (A.K.A. Modulo) does.0
Categories
- All Categories
- 5.5K RobotStudio
- 398 UpFeed
- 19 Tutorials
- 13 RobotApps
- 299 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 324 IRC5
- 63 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 813 RAPID Programming
- 5 AppStudio
- 3 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings