Also, you will want to change || to &&. As it stands, you’re checking
that name is either not equal to “bob” or not equal to “fred”.
Whatever you put in there, it’s going to be not equal to one of them
Logic is tough to grasp at first but stick at it. It’ll become clear
if you practice!
Your logic is off. You’re wanting to see if name is either “bob” or
“fred”, right? Then you have to do:
if (name != “bob”) && (name != “fred”)
or, better still:
unless [“bob”, “name”].include? name
What you’ve written is trying to compare name to a boolean (specifically
the value of true) since “bob” || “fred” will be evaluated to a boolean
expression.
Also, you will want to change || to &&. As it stands, you’re checking
that name is either not equal to “bob” or not equal to “fred”.
Whatever you put in there, it’s going to be not equal to one of them
Logic is tough to grasp at first but stick at it. It’ll become clear
if you practice!
Thank you so much.
This helped.
James.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.