maybe someone knows the technical answer to the following behaviour:
s = "hello world!"
s == s.upcase
# =>false, because "hello world!" != "HELLO WORLD!"
s == s.upcase!
#=>true, because s is changed before comparison?
Mathias
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This would happen in every language, think of it this way
In both cases, the upcase(!) function has to be called before it can be passed to AreEqual, and in the
upcase!()case, it actually changes the value of s.upcase()returns a new string with the uppercased version of s.