Lesson 02 of 55
8 mins readPython Syntax Rules, Comments & Identifiers
In Plain English
Lua syntax is clean and concise. Semicolons are optional between statements, and comments are denoted with double hyphens `--`.
Deep Dive: How It Works
Optional Semicolons: Semicolons `;` can be used to separate statements on the same line, but are optional.
Single-Line Comments: Prefix comments with `--`.
Multi-Line Comments: Enclose block comments with `--[[ ... ]]`.
Case Sensitivity: Lua is case-sensitive (`Name`, `name`, and `NAME` are distinct).
Core Rules to Remember

Hyphen Comments: Use `--` for single line and `--[[ ... ]]` for blocks.

Case Sensitive: Identifiers and keywords are strictly case sensitive.
Live Interactive Example
Hit Run Code to see it liveComments and Statements in Lua
Python 3.12
1
2
3
4
5
6
7
8
9
10
11
Output Console
Click "Run Code" to view the rendered output.
How it works: Statements executed cleanly with both single and multi-line comments.
Your Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Micro Exercise
Declare Lexical Variables
Declare `local engine = "LuaJIT"` and `local speed = 100`.
Print `"Engine: " .. engine .. " Speed: " .. speed`.
1
2
Sandbox Output
Click "Run & Check" to test your solution.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.