'AND' vs '&&' as operator

后端 未结 10 800
野性不改
野性不改 2020-11-22 02:42

I have a codebase where developers decided to use AND and OR instead of && and ||.

I know that there is a

10条回答
  •  深忆病人
    2020-11-22 03:12

    which version are you using?

    If the coding standards for the particular codebase I am writing code for specifies which operator should be used, I'll definitely use that. If not, and the code dictates which should be used (not often, can be easily worked around) then I'll use that. Otherwise, probably &&.

    Is 'and' more readable than '&&'?

    Is it more readable to you. The answer is yes and no depending on many factors including the code around the operator and indeed the person reading it!

    || there is ~ difference?

    Yes. See logical operators for || and bitwise operators for ~.

提交回复
热议问题