Teri Teri - 3 months ago 10
Ruby Question

Can someone help me understand != in Ruby?

I'm working on learning Ruby on codecademy. I've gotten to comparators and am sure I'm not understanding !=.
The directions say, exactly "You can also check to see if two values are not equal using the != comparator."
What's the need to check whether something is specifically NOT equal to something else? Does this only apply to numbers? Would anyone be willing to give me 2-3 examples?

Answer

Here are some examples of !=

"a string" != "another string"
[1,2,3] != [3,2,1]
{ key: "value" } != { key: "another value" }

Is this what you are looking for?

Comments