Why we should use or operator I. Java In loops. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why we should use or operator I. Java In loops.

Java loops

27th Oct 2019, 2:44 AM
Akshat Jain
Akshat Jain - avatar
3 Answers
+ 5
When you have more then one condition foe stopping the loop you should use the or/and operator. The or operator is for separating between the conditions and make each one like a single condition. The and operator is for connecting conditions and make some conditions to one condition.
27th Oct 2019, 2:56 AM
Eliya Ben Baruch
Eliya Ben Baruch - avatar
+ 4
If you are having multiple conditions & if any of the condition evaluates to true then you have to execute some block of code then OR(||) is used between the conditions, it is the general use of this operator.
27th Oct 2019, 4:44 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
0
Thx everyone
27th Oct 2019, 9:04 AM
Akshat Jain
Akshat Jain - avatar