• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

Check variable to see if odd or even

I have a variable called  x

x  will equal a number  1  to 54

I want to check that variable to see if it is an ODD or EVEN number.

How can a newb do this?

0
VirtueTech
Asked:
VirtueTech
  • 2
2 Solutions
 
vidruCommented:
You can test for odd or even in a formula like this (using Crystal syntax):

NumberVar x := 5;
if x mod 2 = 0 then
  'even'
else
  'odd'

-dave
0
 
mlmccCommented:
That works for CR8 and later.

CR7 use
NumberVar x := 5;
if remainder(x,2) = 0 then
  'even'
else
  'odd'

mlmcc
0
 
mlmccCommented:
Glad i could help

mlmcc
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now