2013年10月14日 星期一

布林運算邏輯閘應用

Boolean operators
Operator Operation Operand types Result type Example
not       negation         Boolean Boolean not (C in MySet)
and         conjunction        Boolean Boolean Done and (Total > 0)
or       disjunction          Boolean Boolean A or B
xor exclusive disjunction Boolean Boolean A xor B  

(還有shrshl 的邏輯位移運用)
(引用於Borland Delphi 7內的F1說明,邏輯閘的說明)
可以用上述的方式來判斷True 或Flase 使用上性能表現比IF判斷值行好很多
例:
 cbFG_QT_CTL.Enabled := (State='Insert') or (State='Query');

上句敘述相同於

IF  (State='Insert') or (State='Query') Then
    cbFG_QT_CTL.Enabled:= True;
else
     cbFG_QT_CTL.Enable:= False;


沒有留言:

張貼留言