Posted 11 February 2013 - 06:40 AM
I have created a simple programs:
But if I write 3 the result is "isn't a number"
I have saw that the problem is "not" because if I running this programs work fine:
Or, there is another way to obtain the same output of "if not" ?
write("")
string1 = read()
string1 = tonumber(string1)
if not string1 == nil then
print("It's a number!")
else
print("Isn't a number")
end
But if I write 3 the result is "isn't a number"
I have saw that the problem is "not" because if I running this programs work fine:
write("")
string1 = read()
string1 = tonumber(string1)
if string1 == nil then
print("Isn't a number")
else
print("It's a number!")
end
Why?Or, there is another way to obtain the same output of "if not" ?