Reference · Linotte

Linotte

This reference expands the syntax and features documented for Linotte 3.x: actors and roles, expressions, collections, functions, species, events, and Atelier tools. Code terms remain in French; the explanations describe each construction without translating its syntax.

Reference LinotteSyntax French

01 · Overview

About Linotte

Linotte is an educational project whose syntax uses French words and phrases. The official project presents an environment for learning programming fundamentals and includes examples of variables, interaction, conditions, loops, calculations, and functions.

Code on this page remains in French so it can be compared with the original files. Translating keywords such as affiche, prend, or ferme would change the syntax.

02 · Organization

Program and comments

A Linotte program is a set of instructions in a project file. Introductory examples do not require an outer block around the whole program. An instruction can occupy one line; multi-line blocks end with ferme.

Line comments start with //. Multiline comments use /* and */.

affiche "Bonjour !"
// This comment ends at the line break.
/*
This whole block is ignored
while interpreting the program.
*/

03 · Data

Variables and values

Linotte describes variables as actors: each actor has a name, a role (its type), and a value. The introductory guide presents five basic roles: texte, nombre, drapeau, casier, and espèce. Declare a role with est un; if omitted, the first value assigned with prend can determine the type.

prénom est un texte
prénom prend "Clément"
affiche prénom
prénom prend "Jade"

compteur est un nombre
compteur prend 10
compteur prend compteur + 1

actif est un drapeau
actif prend vrai

mois est un casier de textes valant "janvier", "février", "mars"

drapeau stores a logical value, vrai or faux. Actor names may include accents, as in prénom; type words and text values remain in French.

04 · Interaction

Input and output

affiche displays an expression. demande asks for a value and stores it in the named actor; declare its type before reading it.

prénom est un texte
affiche "Quel est ton prénom ?"
demande prénom
affiche "Bonjour " + prénom

questionne prénom sur "Quel est ton prénom ?" combines the question and value input in one instruction. Text and expressions can be joined with +.

05 · Expressions

Operators and math

GroupFormsUse
Arithmetic+ - * /Basic operations.
Power and remainderpuiss, modExponentiation and modulo.
Comparison= != > < >= <=Compare numbers or text.
Logicet ou xouConjunction, disjunction, and exclusive disjunction.

Official examples also include carré, cube, racine, abs, arrondi, sin, cos, tan, exp, log, logn, and hasard.

affiche carré 4
affiche 2 puiss 4
affiche (2 puiss 3 + 5 * 2) / 3
affiche vrai ou faux

06 · Decisions

Conditions

si starts a condition and sinon introduces the alternative. A simple instruction can follow on the same line; multi-line blocks end with ferme.

note est un nombre
age est un nombre
note prend 12
age prend 20
si note >= 10 affiche "Très bien !"
sinon affiche "Continue à pratiquer"

si age >= 18
    affiche "Adulte"
    affiche "Accès autorisé"
ferme
sinon
    affiche "Mineur"
ferme

Conditions compare values or test a logical value. Examples show =, !=, >, <, >=, and <=.

07 · Repetition

Loops

pour walks through a numeric sequence with both the starting and ending bounds included. Multi-line blocks end with ferme. pour chaque walks through a collection and makes the current item available in the special actor joker.

compteur est un nombre
pour compteur de 1 à 5 affiche compteur

pour compteur de 1 à 3
    affiche compteur
    attends 200 millisecondes
ferme

mois est un casier de textes valant "janvier", "février", "mars"
pour chaque mois
    affiche joker
ferme

Choose bounds that match the desired number of steps. Inside a pour chaque loop, use joker to read the current item.

08 · Reuse

Functions and return values

A function begins with its name, a colon, and its parameters. Its body can declare local variables, run conditions, and return a result with retourne. Functions can also call themselves recursively.

double : nombre
    retourne nombre * 2
fibonacci : n
    si n < 2 retourne n
    sinon retourne fibonacci(n - 1) + fibonacci(n - 2)

Call a function by placing arguments in parentheses after its name. Official examples use functions to separate calculations and build messages.

09 · Data organization

Collections and extensions

casier groups values that can be visited with pour chaque. The Linotte environment also contains visual examples and additional libraries; these resources depend on that environment and are not necessarily available in every context.

nombres est un casier de nombres valant 2, 4, 6
pour chaque nombres
    affiche joker * joker
ferme

For a specific resource, check its example and the documentation for that component in the original project.

10 · Combined example

Count and branch

limite est un nombre
compteur est un nombre
affiche "Jusqu'à quel nombre compter ?"
demande limite
pour compteur de 1 à limite
    si compteur mod 2 = 0
        affiche compteur + " est pair"
    sinon
        affiche compteur + " est impair"
    ferme
ferme

This example combines declarations, input, repetition, and a decision. Syntax terms remain in French.

11 · Collections

Collection access and iteration

A casier groups values so a program can visit them without repeating instructions. Official examples start indexes at zero: three items use positions 0, 1, and 2. Braces read an item; ajoute adds a value to another collection.

nombres est un casier de textes valant "Lia", "Caio", "Noa"
indice est un nombre
pour indice de 0 à 2
    affiche nombres{indice}
ferme

pour chaque nombres
    affiche joker
ferme

Within pour chaque, joker represents the current item, so the program does not need to calculate the last index.

12 · Compact syntax

Shortcuts and interpolation

The official tutorial documents compact forms for displaying, requesting, and assigning values. Interpolation inserts an actor's value inside a string between braces.

prénom est un texte
prénom ?                    // request a value
"Bonjour, {prénom} !" !     // display interpolated text
prénom = "Jules"            // shorthand for prend
"Bonjour, " & prénom !

& can group actions or values, and § can replace ferme in some shorthand forms. Start with full instructions when learning the structure.

13 · Built-in operations

Built-in functions

Linotte includes mathematical operations and methods for inspecting or transforming text. Some functions use prefix notation; text methods follow a value with a dot and parentheses.

GroupDocumented formsPurpose
Mathcarré, cube, racine, abs, arrondi, puiss, modPowers, square root, absolute value, rounding, and remainder.
Trigonometrysin, cos, tan, asin, acos, atanTrigonometric functions.
Textinverser(), minuscule(), majuscule(), capitaliser(), remplacer()Transform or replace text.
Inspectiontaille(), position(), extraire()Measure, locate, and extract text fragments.
phrase prend "Bonjour la Terre"
affiche phrase.majuscule()
affiche phrase.remplacer("Terre", "Lune")
affiche phrase.taille()

et, ou, and xou appear as logical operations in examples; consult the original reference for each call's exact form.

14 · Modeling

Species and prototypes

An espèce defines a custom actor type with attributes. Its declaration specifies each attribute's role; creating an actor assigns values. Examples read them as attribute de actor or attribute@actor.

espèces
    nom & famille est un texte
    pattes est un nombre
    espèce animal contient nom, famille, pattes

principal :
    chat est un animal, nom prend "Mimi", famille prend "félin", pattes prend 4
    affiche nom de chat
    affiche famille@chat

A species can inherit from another and add attributes. The Atelier can also attach functions to prototypes; these features extend the basic data model.

espèces
    couleur est un texte
    espèce fleur hérite de point et contient couleur

15 · Atelier features

Events, graphics, and tasks

The Atelier includes graphical objects such as toile, cercle, rectangle, image, and graffiti, along with mouse events and tasks started with appelle and synchronized with observe. These depend on the environment and are not needed for text algorithms.

alarme :
    attends 2 secondes
    affiche "Temps écoulé."
    reviens

appelle alarme
observe alarme

Event types include clicks, double clicks, and pointer entry or exit. Consult the original project for graphic attributes and task execution rules.

16 · Diagnostics

Errors and debugging

The tutorial uses essaie with a sinon alternative for runtime errors and débogue to start step-by-step tracing in the Atelier.

  • Read the error and identify the active instruction.
  • Step through execution and inspect actors used in each calculation.
  • Check that loops change state and can reach their stopping condition.
  • Test empty collections, a single item, and index boundaries.

The form and availability of these tools depend on Linotte Atelier; this reference describes the original environment.

17 · Further reading

References

Return to the Potoo IDE Manual

Explore the other references and project information.

Open the Manual