Mathematica > Core Language > Expressions > Testing Expressions > OddQ >
Mathematica > Core Language > Procedural Programming > Conditionals > Testing Expressions > OddQ >

OddQ

OddQ[expr]
gives True if expr is an odd integer, and False otherwise.
  • OddQ[expr] returns False unless expr is manifestly an odd integer (i.e., has head Integer, and is odd).
Test whether 9 is odd:
OddQ gives False for non-numeric expressions:
Test whether 9 is odd:
In[1]:=
Click for copyable input
Out[1]=
 
OddQ gives False for non-numeric expressions:
In[1]:=
Click for copyable input
Out[1]=
Test whether a vector consists of odd integers:
An integer is either odd or even. Use EvenQ to check that an integer is even:
Odd integers are not divisible by :
Expressions that represent odd integers but do not evaluate explicitly will still give False:
It is necessary to use symbolic simplification first:
New in 1
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF