Mega Code Archive

 
Categories / Ruby / String
 

Eql and == are slightly different

# == returns true if two objects are Strings, false otherwise. # eql? returns true if two strings are equal in length and content, false otherwise. # Here eql? returns false: hay = 'aaa' aaa = 'aaa' puts (hay.eql? aaa)