lua基本使用

function norm (x, y)
  local n2 = x^2 + y^2
  return math.sqrt(n2)
end

function twice (x)
  return 2*x
end

print(norm(1,2))
print(twice(3))

print(a)
a = 10
print(a)
a = nil
print(a)
a = 'a'
print(a)

--single line note

--[[
  multiline note
]]--

2.2360679774998
6
nil
10
nil
a

你可能感兴趣的:(lua)