• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua How can i check if is odd number?

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,210
Solutions
35
Reaction score
206
Hi, i need a function to check if the numer is odd number.
LUA:
local numbers = {1,2,3,4,5,6,7}
for i = 1, #numbers do
   need print only odd numbers
end
 
Solution
Use modulo.

LUA:
local numbers = {1,2,3,4,5,6,7}
for i = 1, #numbers do
  if numbers[i] % 2 ~= 0 then
    print(numbers[i])
  end
end
Back
Top