Variables

A variable binds a name to a value with =. Baobab is dynamically typed: you don't write the type — it is inferred from the value, and a variable can later hold a different type.

1
2
3
4
5
6
nom = "Aminata" # texte (str) age = 17 # entier (int) taille = 1.63 # decimal (float) est_etudiant = vrai # booleen (bool) afficher(nom + " a " + texte(age) + " ans")
Aminata a 17 ans

Booleans and the empty value are written vrai, faux and nul (Python: True, False, None). To join a number with text, convert it first with texte(...) — like str(...) in Python.

Converting between types

1
2
3
age = entier("17") # texte → entier prix = decimal("9.99") # texte → decimal etiquette = texte(42) # nombre → texte

Variable names use plain ASCII without accents (age, prenom, est_etudiant), like Python identifiers. Accents belong only in displayed text, never in names.