Difference between revisions of "If/fr"

From Lazarus wiki
Jump to navigationJump to search
(Created page with "{{If}} Ce mot-clé précède une condition, et doit être suivi par then et éventuellement par else. == If then == <syntaxhighlight>...")
 
m (Fixed syntax highlighting; deleted category included in page template)
 
Line 5: Line 5:
 
== If then ==
 
== If then ==
  
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
   if condition
 
   if condition
 
     then true_statement
 
     then true_statement
Line 20: Line 20:
 
Si vous avez besoin de plus d'une instruction pour true_statement ou false_statement, placez-les dans un [[Block/fr|bloc]] [[Begin/fr|begin]] ... [[End/fr|end]].
 
Si vous avez besoin de plus d'une instruction pour true_statement ou false_statement, placez-les dans un [[Block/fr|bloc]] [[Begin/fr|begin]] ... [[End/fr|end]].
  
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
   if boolean_condition then
 
   if boolean_condition then
 
     begin
 
     begin
Line 33: Line 33:
  
 
{{Keywords/fr}}
 
{{Keywords/fr}}
[[Category:Pascal/fr]]
 
[[Category:Control Structures/fr]]
 

Latest revision as of 11:39, 17 February 2020

Deutsch (de) English (en) suomi (fi) français (fr) русский (ru) 中文(中国大陆)‎ (zh_CN)

Ce mot-clé précède une condition, et doit être suivi par then et éventuellement par else.

If then

  if condition
    then true_statement
    else false_statement;

Condition est une expression Boolean évaluée à true or false. true_statement est exécuté si condition est évaluée à True. false_statement est exécuté si condition est évaluée à False. Une erreur de compilation survient si la condition ne donne pas une valeur booléenne.

Plus d'instructions dans l'instruction "if then"

Si vous avez besoin de plus d'une instruction pour true_statement ou false_statement, placez-les dans un bloc begin ... end.

  if boolean_condition then
    begin
      statement_one;
      statement_two;
      statement_three;
    end;

Documentation

Documentation officielle : [1]


Mots-clés: begindoelseendforifrepeatthenuntilwhile