B
B
beduin012015-12-16 09:38:24
Programming languages
beduin01, 2015-12-16 09:38:24

Why do C-like languages ​​use such awkward logical operators?

It has always been a mystery why all C-like languages ​​use such inconvenient, hard to read and printable operators as && || etc. What prevented you from using the keywords AND, OR, etc.?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
D
D', 2015-12-16
@Denormalization

awkward and hard to read and print statements

A very subjective opinion.
The authors of the language considered the same, and did what they thought was more convenient.
PS
& and | are boolean AND and OR. The authors simply doubled them, and they got logical operators.

O
Optimus, 2015-12-16
Pyan @marrk2

In php I always use || and & despite the fact that AND and OR are possible

V
Vasily, 2015-12-16
@Foolleren

si is a rather old language and in those distant times there were problems with memory and compilation speed
for these reasons in si short operators of one or two characters, legs and curly braces and case sensitivity grow from there, all this increases the speed of the compiler,

J
jackroll, 2015-12-16
@jackroll

At the beginning of the file write

#define AND &&
#define OR ||

You can give up on programming now, because it will only get more difficult later on. Find yourself another hobby.
For hard-nosed. Google materiel.
https://ru.wikipedia.org/wiki/%D0%9C%D0%B0%D1%82%D...
https://ru.wikipedia.org/wiki/%D0%9E%D1%82% D1%80%D...
https://ru.wikipedia.org/wiki/%D0%9A%D0%BE%D0%BD%D...
https://ru.wikipedia.org/wiki/% D0%94%D0%B8%D0%B7%D...

O
oteuqpegop, 2015-12-17
@oteuqpegop

SUDDENLY in C++, and and or are alternative tokens for && and ||. So you can use them, no one bothers you. Although IMHO && and || look better and generally gain faster.
By the way, the previous comment with the advice to the questioner to forget about programming looks a little strange, given that the commentator himself suggests making a bicycle through defines.

V
vadimkavadimka, 2015-12-17
@vadimkavadimka

To make it easier to distinguish from variable names, e.g. The coffeescripters thought the same, and then the code looks like a line of text, making it hard to split into semantic units.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question