What's the difference between a string and a symbol in Ruby?

后端 未结 10 1305
说谎
说谎 2020-11-28 06:52

What\'s the difference between a string and a symbol in Ruby and when should I use one over the other?

10条回答
  •  一生所求
    2020-11-28 07:23

    An additional difference between String and Symbol is that a String has a lot more methods on it for string manipulation, while a Symbol is a relatively lean object.

    Check out the documentation for the String class and the Symbol class.

提交回复
热议问题