0

I am having an issue with this if statement with multiple conditions. I do know for a fact that the individual conditions run fine, only when they are together does it have issues. Specifically the issue is that it will return false even though the condition is met and if i ungrouped it with the same input it would work.

if(dnaArray[i] != "a" || dnaArray[i] != "c"|| dnaArray[i] != "t" || dnaArray[i] != "g")

Also i'm sorry if this isn't exact to the guidelines, if there is an issue just let me know and I will fix it.

  • of course that's always true ... `dnaArray[i]` can't be equal to more than one thing, so therefore it must be not equal to at least on of those values, therefore at least one part will be true, and **or** means the result will be true - note: the accepted answer in the "duplicate" has absolutely **no value** - two of the other answers **actually explain what is going on** – Jaromanda X Apr 27 '17 at 13:18
  • use && instead of || – Anmol Mittal Apr 27 '17 at 13:19
  • 1
    oh im so stupid – Programmerdave Apr 27 '17 at 13:22

0 Answers0