Comments
Luma supports simple and clean commenting, helping you document your code without clutter or confusion.
Single-Line Comments
Use // for standard single-line comments — similar to languages like Go, JavaScript, and C++:
// This is a single-line comment
name: str = "Luma" // You can also comment after a statementMulti-Line Comments
Luma does not use /* … */ for multi-line comments. Instead, simply stack multiple // lines:
// This is a longer explanation
// that spans multiple lines
// and remains readable and clear.
fn greet(name: str) -> str {
return "Hi ${name}"
}Why This Approach?
- Cleaner parsing - avoids complexity of nested
/* ... */ - Better version control diffs – line-by-line visibility
- Editor-friendly - aligns with most IDE line comment shortcuts
Best Practices
- Use comments to explain why, not what.
- Keep them short, focused, and consistent.
- Use them to separate logic or highlight edge cases.
// Load configuration from file
config: str = read_file("config.txt")
// Check if user is authorized
if role == "admin" {
// Allow access
access: bool = true
}Last updated on