1.3 · WLangage basics (variables, conditions, loops)

Level 1 · Beginner: first application

1.3WLangage basics (variables, conditions, loops)

Goal: Master the basic building blocks of WLangage — typed variables, operators, conditions, loops — and readability reflexes.
Estimated time: 12 min · self-paced reading · If you only have 5 min: read “The essentials in 30s” + the diagram.

The essentials in 30 seconds

  • A variable has a type: integer, real, currency, string, boolean, date… The right type avoids wrong calculations and comparisons.
  • The SI…ALORS…SINON…FIN condition executes a block depending on a test: it is the building block of all business logic.
  • POUR and TANTQUE loops repeat a process (known or unknown count); naming, indenting and commenting make the code maintainable.

Running mini-case — Yacine writes his first discount rule

Yacine now has an analysis (1.1) and a window (1.2). He wants to apply his first business rule: grant a 5% discount to orders with more than ten items, and block validation if the customer has unpaid invoices. He declares typed variables: MontantHT as currency, Remise as real, NbArticles as integer. He writes a CONDITION SI…ALORS…SINON: if the customer's balance is positive (unpaid), he blocks; otherwise he tests the number of items. He adds a POUR loop to add up the amount of the item lines. He clearly names his variables (not x or tmp), indents his blocks and comments the WHY of the discount. The code reads like a sentence. Yacine remembers: typed variables, conditions and loops are the building blocks of all logic — and readability makes the difference.

Standalone case for this section: it returns in the course, diagram, script and 48h challenge of section 1.3.

1. Variables and types

WLANGAGE is WinDev's language. Its fundamentals are those of any language, with a deliberately simple, French syntax. VARIABLES are named locations that store a value; they are declared with their TYPE: integer, real, currency, string, boolean, date, time, duration.

Example: MonTotal est un monétaire. The choice of type remains important: an amount as currency, a counter as integer, a text as string — never everything as string, or calculations will be wrong.

2. Operators and conditions

OPERATORS are arithmetic (+, -, *, /), comparison (=, <, >, <=, >=, <>) and logical (ET, OU, PAS). Comments (// at the start of a line) explain the WHY of a process.

The CONDITION SI … ALORS … SINON … FIN executes one block or another depending on whether a test is true or false. It is the building block of all business logic: if the balance is negative, apply a discount, etc. The multiple branch SELON handles several cases of the same value.

3. Loops and readability

LOOPS repeat a process: POUR (known number of repetitions, with a counter), TANTQUE (as long as a condition remains true) and BOUCLE (with an explicit exit).

Two quality principles from the start: name your variables clearly (Total, NombreArticles — not x, y, tmp) and indent your code to make the structure visible. A valuable reflex: the F1 key, which opens WLangage help with examples, in French.

Common misinterpretation: “WLangage is in French, so rigor is optional”. No. Simple syntax does not excuse you from typing correctly (everything as string makes calculations wrong), naming your variables and indenting your blocks. Another mistake: stacking SI inside SI until it becomes unreadable. Yacine names explicitly, indents, comments the why, and chooses the right type for each variable.
Executing a process Typed variables, a condition that chooses, a loop that repeats. Typed variables Currency,string, boolean…SI…ALORS…SINON condition Choosea block based on a testPOUR / TANTQUEloops Repeat a process
Typed variables, a condition that chooses, a loop that repeats.
Text version of the diagram (SEO / screen readers / translation): 1) Yacine, a WinDev developer at an electrical equipment trading SME in Oran, wants to write his first business rule: 5% discount beyond ten items, validation blocked if the customer has unpaid invoices. 2) He declares typed variables (MontantHT as currency, Remise as real, NbArticles as integer), writes a SI Client.Solde > 0 ALORS … SINON … FIN condition and a POUR loop to add up the lines. 3) He clearly names his variables, indents his blocks and comments the why of the discount. Lesson: typed variables, conditions and loops are the building blocks of all logic — with readability as a requirement.

🔎 Concrete example — 🔎 Concrete example — Yacine's discount

The application's first business rule, in WLangage:

// Remise fidélité — Yacine, négoce de matériel électrique
MontantHT est un monétaire = 0
Remise    est un réel      = 0

SI Client.Solde > 0 ALORS
	Info("Impayés : validation de la commande bloquée.")
SINON
	// 5 % de remise au-delà de 10 articles
	SI Commande.NbArticles > 10 ALORS
		Remise = 5
	FIN
FIN

POUR i = 1 À Commande.NbArticles
	MontantHT += LigneCommande[i].PrixHT * LigneCommande[i].Quantite
FIN

Reading: typed variables, a condition that blocks on unpaid invoices, a second that decides the discount, a loop that adds up the amount.

Reflex: explicit names, block indentation, comment on the why — the code reads like a sentence.

Section vocabulary

Variable and type
Named location that stores a value, declared with its type: integer, real, currency, string, boolean, date, time, duration.

Simple example: Yacine declares MontantHT est un monétaire and NbArticles est un entier.

What it is not: storing an amount as a string then trying to add it.

Reflex: a piece of data → a suitable type.

Operators
Arithmetic (+, -, *, /), comparison (=, <, >, <=, >=, <>) and logical (ET, OU, PAS), in French.

Simple example: Yacine tests Commande.NbArticles > 10 ET Client.Solde = 0.

What it is not: comparing two strings to add amounts.

Reflex: a test → the right operator.

SI…ALORS…SINON condition
Structure that executes one block or another depending on whether a test is true or false; basic building block of all business logic.

Simple example: If the customer has unpaid invoices, Yacine blocks validation.

What it is not: chaining nested SI until the code becomes unreadable.

Reflex: decide → a SI condition.

Loops (POUR, TANTQUE)
POUR repeats a known number of times (with a counter); TANTQUE repeats as long as a condition remains true; SELON handles a multiple branch.

Simple example: Yacine adds up the order lines with a POUR loop.

What it is not: copying the same line twenty times instead of using a loop.

Reflex: repeat → a POUR or TANTQUE loop.

Readability (names + indentation)
Naming variables clearly, indenting blocks, commenting the why: what makes code maintainable.

Simple example: Yacine writes MontantTotalHT and not m, and indents each block.

What it is not: variables x, tmp1, tmp2 and no block indentation.

Reflex: readable code → clear names + indentation.

In practice — In practice — Writing your first lines of WLangage

  1. Declare variables with the right TYPE (an amount as currency, a counter as integer, a text as string, a test as boolean).
  2. Write a CONDITION SI…ALORS…SINON…FIN expressing a simple business rule (if the amount exceeds a threshold, apply a discount).
  3. Write a POUR loop to repeat a process a known number of times, and a TANTQUE loop for an unknown number in advance.
  4. Name your variables clearly, INDENT the blocks, comment the WHY, and use F1 on any unknown function.
You master the basic building blocks of WLangage (typed variables, operators, conditions, loops) and the readability reflexes that make code maintainable — the ones Yacine applies from his first discount rule.

Step-by-step script — writing the discount rule like Yacine (5 min)

1) Declare the variables with the right type (MontantHT as currency, Remise as real, NbArticles as integer). 2) Write the condition SI Client.Solde > 0 ALORS block SINON test the discount FIN. 3) Add the nested condition SI NbArticles > 10 ALORS Remise = 5 FIN. 4) Add up the amount with a POUR loop over the lines. 5) Name, indent and comment, then test with F1 at hand.

The concepts (variables, conditions, loops) are universal: what changes from one language to another is the syntax.

Copy-paste template — Yacine's processing structure

// 1. Variables typées
Total est un monétaire = 0
Compteur est un entier = 0

// 2. Condition
SI  ALORS
	// action si vrai
SINON
	// action si faux
FIN

// 3. Boucle
POUR i = 1 À 
	// traitement répété
FIN

// Réflexes : noms clairs, blocs indentés, commentaire du POURQUOI

Tiered discount

Yacine replaces the simple SI with a SELON: 3% beyond 5 items, 5% beyond 10, 8% beyond 20.

Unknown count

To iterate over a customer's orders, Yacine uses a TANTQUE loop rather than a POUR.

Stock check

Before validating a line, Yacine writes a condition that rejects a quantity greater than the available stock.

Total

To calculate an order's total amount, Yacine adds up the lines with a POUR loop and a currency variable.

✓ Best practices

  • Declare each variable with the suitable type.
  • Name clearly and indent blocks for readability.
  • Use F1 on any unknown function: the help is rich and in French.

✗ Common pitfalls

  • Storing everything as a string: wrong calculations and comparisons.
  • x, tmp1, tmp2 variables that are incomprehensible.
  • Stacking nested SI until unreadable.

Key takeaways

  • WLangage relies on universal fundamentals, with a simple French syntax.
  • Variables are declared with a TYPE: an amount as currency, a counter as integer, a date as date.
  • The SI…ALORS…SINON…FIN condition and the POUR / TANTQUE / SELON loops drive execution.
  • Quality reflexes: NAME, INDENT, COMMENT the why, and rely on F1.

48h challenge — apply it tomorrow

Write in WLangage, like Yacine, a small business rule: typed variables, a SI…ALORS…SINON condition and a POUR loop. For example: apply a discount beyond a threshold and add up an amount. Write in one sentence why the choice of a variable's type matters.

Section exit checklist
  • I declare variables with the right type in WLangage.
  • I know how to write a SI…ALORS…SINON…FIN condition.
  • I know how to repeat a process with a POUR or TANTQUE loop.
Self-assessment 1-5: do I choose the right type for my variables?Self-assessment 1-5: is my code named, indented and commented?

Frequently asked questions

Do I need to know another language before learning WLangage?

No: WLangage is designed to be accessible to beginners, with French keywords (SI, ALORS, POUR, TANTQUE), readable syntax and rich contextual help. If you already know a language, you will progress faster because the concepts are universal — but what you mainly need to learn is the WinDev philosophy: the analysis at the center, controls linked to items, HFSQL functions and event-driven operation.

How do I write readable, maintainable WLangage code?

By applying simple but consistent rules: name explicitly (MontantTotalHT, not m), indent blocks, comment the WHY (not the WHAT), split long processes into procedures and avoid duplication. Code is read far more often than it is written: clear names, a visible structure and useful comments save considerable time during future fixes.

Check your understanding

Which basic structures are used in WLangage to repeat a process?

Additional resources (optional, to go further)

Level 1 examFresh, harder questions to test what you've learned