Bit operation. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Bit operation.

What does b/a?a:b mean? Where a and b are integers.

2nd Dec 2019, 9:56 AM
Pir-CHILD
Pir-CHILD - avatar
2 ответов
+ 3
That is called a ternary operator. If b/a is greater than 0 than it will assign the value of "a" to the variable or if b/a is 0 then it will assign the value of "b" to the variable. It is a simple if else statement.
2nd Dec 2019, 10:14 AM
Avinesh
Avinesh - avatar
+ 2
This is not bit operation. It is ternary operator syntax with (IF Condition is true) ? (Do this) : (Else Do this);
3rd Dec 2019, 7:57 AM
RKK
RKK - avatar