使用引号初始化字符串与在其前面使用冒号初始化字符串有什么区别?即“bobo”与:bobo。当您检查它们时,它们看起来相同,但是当您比较它们时,结果评估为假。
irb(main):006:0> r = "bobo"
=> "bobo"
irb(main):007:0> puts r
bobo
=> nil
irb(main):008:0> t = :bobo
=> :bobo
irb(main):009:0> puts t
bobo
=> nil
irb(main):010:0> puts r == t
false
=> nil
irb(main):011:0> s = "bobo"
=> "bobo"
irb(main):012:0> puts r == s
true
=> nil