看板 Soft_Job 關於我們 聯絡資訊
: The parts of an expression containing && or || operators are evaluated only : until it’s known whether the condition is true or false. Thus, evaluation : of the express : ( gender == FEMALE ) && ( age >= 65 ) : stops immediately if gender is not equal to FEMALE (i.e., the entire : expression is false) and continues if gender is equal to FEMALE (i.e., : the entire expression could still be true if the condition age >= 65 is true). : This feature of conditional AND and conditional OR expressions is called s : hort-circuit evaluation. : ※ 編輯: icecastleo 來自: 111.243.0.134 (03/28 20:51) || 如果前者為真,可以省略後算,直接回傳為真 && 如果前者為偽,可以省略後算,直接回傳為偽 請搞清楚邏輯關係... 相反的 || 如果前者為偽,絕對不是像我同事說的,回傳為偽,省略後算 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.70.5.247
cloud1230:扯= = 03/28 21:03
※ 編輯: erspicu 來自: 219.70.5.247 (03/28 21:03)
shemale:同意,但這麼基本的問題...會不會是你同事一時口誤? 03/28 21:06
erspicu:我剛開始也覺得很扯 應該是口誤 但是他們後來很認真糾正我 03/28 21:07
erspicu:我就確定 真的是他們搞錯了 03/28 21:07
yauhh:就這句扯而已 03/28 21:11
shemale:如果我是老闆,大概會叫他們走路了,基本中的基本中的基本 03/28 21:12
chang0721:這個不是基本嘛? 03/28 21:18
erspicu:印象中國中還是高中就有教最基本邏輯概念了 好神奇 03/28 21:20
erspicu:我其實滿反對 直接拿bitwise在if條件式中用的 03/28 21:23
yauhh:java很多自己亂取名字的method都塞進if條件式了,卻怕小小 03/28 21:25
yauhh:幾個bitwise op 03/28 21:26
erspicu:bitwise有它自己底層的意思 如果不了解編譯器行為 03/28 21:27
erspicu:或許未必會出錯 但是這是一知半解的 03/28 21:27
erspicu:以C/C++的人來說 會用bitwise的 大概是要求最佳速度化 03/28 21:29
erspicu:通常是高手比較會用 怎麼Java反來把bitwise使用視為當然 03/28 21:30
starskgb:我比較好奇原po公司是哪間XD 03/29 20:53