看板 Visual_Basic 關於我們 聯絡資訊
在VB.NET裡 假設兩段判斷式: 1. if a and b then ... 2. if a and c then ... 可不可以寫成 if a and b or c then .. 還有 if x>y and i>j then 的 x>y i>j 要不要()--> (x>y) (i>j) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.72.0.201 ※ 編輯: SUZUKI1127 來自: 203.72.0.201 (10/14 13:49)
fumizuki:你的目標是 a and b and c 還是 a and (b or c) ??? 10/14 17:28
fumizuki:比較運算子 > = < >= <= <> 的優先等級比邏輯運算子大 10/14 17:29
fumizuki:所以不需要加() 10/14 17:31
fumizuki:精華區 12-1-6-4 有說明 10/14 17:32
SUZUKI1127:目標是 a and (b or c) 10/14 23:19
SUZUKI1127:再問 a and b and c 這樣的寫法 是ok的嗎? 10/14 23:22
fumizuki:a and b and c = (a and b) and c 10/15 07:12
fumizuki:運算的先後順序是由左至右 以結果論 a and b and c 10/15 07:12
fumizuki:abc三者皆為 True 的時候 條件式成立 10/15 07:13