First program

Every AlgoLab program follows the same structure: declarations, then Debut ... Fin.

Hello World

Create a file hello.algo:

exemple.algo
Variable msg : Caractere
Debut
  msg <- "Hello world!"
  Ecrire msg
Fin

Run: algolab hello.algo → prints Hello world!

Interactive program

exemple.algo
Variable nom : Caractere
Variable age : Entier
Debut
  Ecrire "What's your name?"
  Lire(nom)
  Ecrire "How old are you?"
  Lire(age)
  Si age >= 18 Alors
    Ecrire "Welcome, ", nom, "!"
  Sinon
    Ecrire "Hi ", nom, "!"
  FinSi
Fin

One-liner execution

The -c mode lets you test without creating a file:

algolab -c 'Variable x : Entier Debut x <- 42 Ecrire x Fin'