How the check if the number is odd or even?

Is there any function that returns if the number is odd or even?

I want to use it like this:
If odd(i) then print(“number %i is odd”)
else (“number %i is even”) end

[import]uid: 110918 topic_id: 20940 reply_id: 320940[/import]

found myself ))))))
if math.mod(i, 2) == 0 then print(“even”) end [import]uid: 110918 topic_id: 20940 reply_id: 82657[/import]

if i % 2 == 0 then  
print (i, " is even")  
else  
print (i, " is odd")  
end  

to do it your way with a function:

local function odd(theNumber) return not( theNumber % 2 == 0 ) end [import]uid: 108660 topic_id: 20940 reply_id: 82659[/import]

[lua] local test=999
if test%2 == 0 then
print “EVEN”
else
print “ODD”
end[/lua] [import]uid: 10389 topic_id: 20940 reply_id: 82658[/import]

try this
[lua]local function odd(num)
if num % 2 == 0 then
return false
else
return true
end
end

local i = 9
if odd(i) then
print(“number “… i …” is odd”)
else
print(“number “… i …” is even”)
end[/lua] [import]uid: 71210 topic_id: 20940 reply_id: 82661[/import]