數(shù)學代數(shù)教學總結 在學習vb過程中,很多同學簡單地認為布爾值true就是-1或非0值,false就是0,這種看法是錯誤,下面將布爾值、邏輯運算和關系運算總結如下: 在vb中,布爾(boolean)值有兩個:true(真)和false(假),布爾值可以用于邏輯、關系(比較)和算術運算中。1)布爾值用于邏輯運算中,結果為布爾值。例如: print not true, not false print true and true, true and false, false and true, false and false print true or true, true or false, false or true, false or false結果為: false true true false false false true true true false【總結】 not 非運算規(guī)則:非真則假,非假則真 and 與運算規(guī)則:只有都是true,結果才為true(只要有一個為false,結果就為false) or 或運算規(guī)則:只有都是false,結果才為false(只要有一個為true,結果就為true)2)布爾值用于關系(比較)運算中,結果為布爾值。