From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- files/zh-tw/glossary/boolean/index.html | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 files/zh-tw/glossary/boolean/index.html (limited to 'files/zh-tw/glossary/boolean/index.html') diff --git a/files/zh-tw/glossary/boolean/index.html b/files/zh-tw/glossary/boolean/index.html new file mode 100644 index 0000000000..c748ca87ac --- /dev/null +++ b/files/zh-tw/glossary/boolean/index.html @@ -0,0 +1,52 @@ +--- +title: 布林 +slug: Glossary/Boolean +tags: + - JavaScript + - 布林 + - 資料型態 +translation_of: Glossary/Boolean +--- +

在電腦科學中,布林值是一種其值僅能為的邏輯資料型別,它是編程語言裡在邏輯上表達真或假的方式。如果沒有這種能力,很多功能會無法實現。舉個例子,JavaScript中的 if 語句 的判斷條件會利用布林值來決定接下來的代碼是否要被執行。又如JavaScript中的 for 循環,如果沒有一個能夠解釋成不林值的判斷條件,循環將不知道是否要繼續循環或停止。

+ +
***JavaScript if Statement***
+if(boolean conditional) {
+   //coding
+}
+
+if(true) {
+  console.log("boolean conditional resolved to true");
+} else {
+    console.log("boolean conditional resolved to false");
+  }
+
+
+
+***JavaScript for Loop***
+for(control variable; boolean conditional; counter) {
+  //coding
+}
+
+for(var i=0; i<4; i++) {
+  console.log("I print only when the boolean conditional is true");
+}
+
+ +

 

+ +

 

+ +

了解更多

+ +

常規知識

+ + + +

技術參考

+ + -- cgit v1.2.3-54-g00ecf