Syntax and types
โ Report an issue with this lessonlocal name = "Ada"
local age = 28
local price = 29.99
print(name .. " is " .. age .. " years old")
local declares a variable scoped to the current block --
without it, a variable is global by default, which is almost always a
mistake in real Lua code. String concatenation uses .., not
+.
Try it yourself
Exercise: Declare local name and age, then print them with concatenation (..).
Expected output: open-ended โ there's no single correct output here, just get your code running without errors.
Run your code and get it working before marking this lesson complete.
// free preview
9 more lessons โ including Capstone project: a course catalog script โ plus a certificate are waiting.
Unlock the full course โ $149.99