aboutsummaryrefslogtreecommitdiff
path: root/files/fr/glossary/boolean/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/fr/glossary/boolean/index.html')
-rw-r--r--files/fr/glossary/boolean/index.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/files/fr/glossary/boolean/index.html b/files/fr/glossary/boolean/index.html
new file mode 100644
index 0000000000..450e535aa5
--- /dev/null
+++ b/files/fr/glossary/boolean/index.html
@@ -0,0 +1,48 @@
+---
+title: Booléen
+slug: Glossaire/Boolean
+tags:
+ - Booléen
+ - Glossaire
+ - JavaScript
+ - Langages de programmation
+ - Types de données
+translation_of: Glossary/Boolean
+---
+<p>En informatique, un <strong>booléen</strong> est un type de données logique qui ne peut prendre que deux valeurs : <code>true</code><strong> </strong><em>(vrai)</em><strong> </strong>ou <code>false</code><em> (faux)</em>. Par exemple, en JavaScript, les conditions booléennes sont souvent ouvertes pour décider quelle section de code doit être exécutée (comme dans l'<a href="https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Instructions/if...else">instruction If</a>) ou répétée (comme pour une <a href="https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Instructions/for">boucle For</a>).</p>
+
+<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="comment token">/* JavaScript instruction if */</span>
+<span class="keyword token">if</span> <span class="punctuation token">(</span>boolean conditional<span class="punctuation token">)</span> <span class="punctuation token">{</span>
+ <span class="comment token">// code à exécuter si la condition est true <em>(vrai)</em></span>
+<span class="punctuation token">}</span>
+
+<span class="keyword token">if</span> <span class="punctuation token">(</span>boolean conditional<span class="punctuation token">)</span> <span class="punctuation token">{</span>
+ console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span><span class="string token">"boolean conditional resolved to true"</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="punctuation token">}</span> <span class="keyword token">else</span> <span class="punctuation token">{</span>
+ console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span><span class="string token">"boolean conditional resolved to false"</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="punctuation token">}</span>
+
+
+<span class="comment token">/* JavaScript boucle for */</span>
+<span class="keyword token">for</span> <span class="punctuation token">(</span>control variable<span class="punctuation token">;</span> boolean conditional<span class="punctuation token">;</span> counter<span class="punctuation token">)</span> <span class="punctuation token">{</span>
+ <span class="comment token">// </span></code> <span id="result_box" lang="fr"><span>code à exécuter répétitivement si la condition est vraie</span></span> <code class="language-js">
+<span class="punctuation token">}</span>
+
+<span class="keyword token">for</span> <span class="punctuation token">(</span><span class="keyword token">var</span> i<span class="operator token">=</span><span class="number token">0</span><span class="punctuation token">;</span> i <span class="operator token">&lt;</span> <span class="number token">4</span><span class="punctuation token">;</span> i<span class="operator token">++</span><span class="punctuation token">)</span> <span class="punctuation token">{</span>
+ console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span><span class="string token">"I print only when the boolean conditional is true"</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="punctuation token">}</span></code></pre>
+
+<h2 id="Pour_Approfondir">Pour Approfondir</h2>
+
+<h3 id="Culture_générale">Culture générale</h3>
+
+<ul>
+ <li><a href="http://fr.wikipedia.org/wiki/Bool%C3%A9en">Booléen</a> sur Wikipedia</li>
+</ul>
+
+<h3 id="Informations_techniques">Informations techniques</h3>
+
+<ul>
+ <li>L'objet JavaScript global : {{jsxref("Boolean")}}</li>
+ <li><a href="https://developer.mozilla.org/fr/docs/Web/JavaScript/Structures_de_donn%C3%A9es">Structures de données JavaScript</a> sur MDN</li>
+</ul>