line = io.read() -- read a line
n = tonumber(line) -- try to convert it to a number
if n == nil then
error(line .. " is not a valid number")
else
print(n*2)
end
키워드 : input, string, number, 숫자출처 : Programming in Lua, Second Edition - 2006 - by Roberto Ierusalimschy
No comments:
Post a Comment