문제

Why do we use "&&" instead of "and" in so many languages? I get that it has sort of become the standard for programmers, but how did that originally happen?

도움이 되었습니까?

해결책

It is up to the language designer to make these decisions, but one reason is that there is two types of and - regular and bitwise (&& vs &)

It's harder to succinctly express the bitwise version using English words

다른 팁

Why did programming languages originally use “&&” instead of “and”?

You have it back to front. Originally they used and: Fortran, Cobol, Algol, Pascal, PL/1, all the varieties of Basic, ...

It was the BCPL series of languages (B, C, C++) that introduced & and && as far as I know, and Java and C# followed suit. You would have to ask the BCPL designers why, if they are still around.

APL used the set-theoretic symbols ^ and its inversion.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top