« Algorithmique impérative/Pascal » : différence entre les versions

Contenu supprimé Contenu ajouté
Ligne 209 :
donne
 
<syntaxhighlight lang="pascal">
if condition then instruction;
</syntaxhighlight>
 
si il y a plusieurs instructions, et bien on utilise un bloc :
 
<syntaxhighlight lang="pascal">
if condition then begin
instruction_1;
instruction_2;
instruction_k;
end;
</syntaxhighlight>
 
Avec une instruction à exécuter quand la condition est fausse (sinon) :
if condition
 
ifsi condition
alors instruction_1
sinon instruction_2
Ligne 225 ⟶ 231 :
se traduit
 
<syntaxhighlight lang="pascal">
if condtion
then instruction_1
else instruction_2;
</syntaxhighlight>
 
De même on peut utiliser des blocs :
 
<syntaxhighlight lang="pascal">
if condition then begin
instruction_1;
instruction_2;
instruction_k;
end
else begin
instruction_3;
instruction_4;
instruction_l;
end;
</syntaxhighlight>
 
== Structures itératives ==