Why does C# && and || operators work the way they do?

前端 未结 7 2001
余生分开走
余生分开走 2020-12-06 14:25

here is a tl;dr

I come from a C++ background. && is suppose to check if left side is true and right side is true. what does & have anything to do with th

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-06 14:31

    If you want both sides to be evaluated you need to use the 'standard' & and | operators. Usually you do want the && and || operators though for efficiency

提交回复
热议问题