Lucia language overview

Learning objective

  • Understand the complete feature map of Lucia and where each concept fits.

Key syntax

let x: int = 10;
const title: string = "Lucia";
if (x > 0) { print(title); }

Examples

  • Control flow: if, else if, else, switch/case/default, while, for, do/while, for...in.
  • Declarations: let, const.
  • Types: int, float, bool, string, date, datetime, void, any.
  • Collections: list<T>, dict<K, V>, literals, indexing.
  • OOP: class, extends, constructor, properties, methods, this.
  • Modules: import "./module.lucia";.
  • Expressions: arithmetic, logical, comparison, assignment, ternary, null coalescing ??.
  • Strings: interpolation with ${expr}.

What is commonly missed

  • In class methods, peer methods can be called with or without this:
func toString(): string {
	return obtenerNombreValor() + " " + obtenerNombrePalo();
}
  • Field access may use this.field or implicit field names when there is no local shadowing.
  • Empty collections can adopt the target type from context:
let players: list<Jugador> = [];
players = [];

let scores: dict<string, int> = {};
scores = {};
  • Indexed assignment is valid for list/dict targets:
this.mazo[i] = this.mazo[j];
this.mazo[j] = temp;
  • Use len(listOrDict) for size. Do not use .length().

Common mistakes

  • Mixing concepts before mastering declarations and types.
  • Ignoring diagnostics while learning new syntax.

Suggested learning path

  • Start with examples/00_features.lucia to cover declarations, collections, loops, and classes.
  • Continue with examples/10_inheritance_const.lucia for inheritance and const fields.
  • Then build a two-file mini project using import, one model class, and one runner script.

Suggested practice

  • Build a mini app that uses imports, classes, lists, conditionals, and interpolation.
  • syntax-control-flow
  • types-and-collections
  • oop-and-modules