https://kotlinlang.org logo
#android
Title
# android
m

Md Sohail

03/07/2024, 9:10 AM
I was just confused so I made this prompt Is this really correct?
m

Messias Junior

03/07/2024, 9:35 AM
Hey, I think this question is more suitable to the #getting-started channel.
c

Chrimaeon

03/07/2024, 9:45 AM
Or write unit tests 😅
🙌 1
f

Frank Bouwens

03/07/2024, 10:51 AM
I think what you’re trying to do is a bit unclear; execute when: a) count is greater than 5 OR b) count is greater than 5, and also divisible by 50 This would make the ‘divisible by 50’ redundant to check; Or you’re checking ‘greater than 5’ twice which is redundant.
Copy code
if (count > 5) {
  // Do something
}
There you go.
a

Akram Raza

03/07/2024, 11:10 AM
No it won't work. It will always execute the block for any count > 50 .
b

Benjamin Szilagyi

03/07/2024, 7:28 PM
@Akram Raza yes, because there is an OR operator 😄