mardi 7 juillet 2020

Why is my Lua if-else not working properly?

print("Type a number:")
firstNum = io.read()
print("Type another number:")
secondNum = io.read()
print("First: " .. firstNum .. "\nSecond: " .. secondNum)
if firstNum > secondNum then
  print("first is bigger than second")
elseif firstNum < secondNum then
  print("first is less than second")
else
  print("first is equal to second")
end

Input:
firstNum = 5
secondNum = 15
Output:
first is bigger than second
Why is that happening?

Aucun commentaire:

Enregistrer un commentaire