warning: string literal in condition

Viewed 17075

Using the first bit of code below I receive two warning messages: warning: string literal in condition x2

if input == "N" || "n"
  #do this
else input == "L" || "l"
  #do this

as opposed to using this which results in no warnings

if input == "N" || input == "n"
  #do this
else input == "L" || input == "l"
  #do this

I'm wondering why the first bit of code results in a warning, and the downside of using it.

4 Answers
Related