warning: string literal in condition

ruby

Solution

change `input == "N" || "n"`

to

input == "N" || input == "n"

You must also use `else if` instead of `else`

The warning is saying that instead of a boolean or test, you have a string literal, ' n', which always evaluates to true.

Problem

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.

Original source