2. Variables and Types

Level: beginner · Reading time: 3 min · Prerequisite: book/poche/01-first-program.html · Last review: 2026-05-09

TL;DR (5 lines)

  • Read the core idea first.
  • Understand one concept at a time.
  • Run small examples.
  • Fix errors early.
  • Move to next chapter only when clear.

Frequent mistakes

  • Skipping prerequisites.
  • Reading without trying examples.
  • Fixing too many errors at once.

Prerequisites: book/poche/01-first-program.html. See also: book/chapters/05-types.html.

Goal

Declare a variable and understand its type.

Example

entry main at app/demo {
  let age: int = 42
  return age
}

Why it matters

An explicit type avoids a lot of invisible errors.

Quick check

If age becomes string, what should be changed?

Try this

  1. Create 2 variables (int, string).
  2. Return a simple value.
  3. Check for possible errors.

If you're stuck

Keep let nom: type = valeur everywhere at the start of learning.

Mini quiz

  1. What is the main goal of this chapter?
  2. Which concept is most important?
  3. What will you try right now?

See also

Next best action

Apply one idea from this chapter in a tiny example, then continue.