It is a common misconception that a symbol is a type of string. After all, isn’t the symbol, :hello pretty similar to the string, ‚hello‛? In fact, symbols are quite unlike strings.
It is a common misconception that a symbol is a type of string. After all, isn’t the symbol, :hello pretty similar to the string, ‚hello‛? In fact, symbols are quite unlike strings.
Some methods in the Ruby class library specify symbols as arguments. Naturally, if you need to call those methods, you are obliged to pass symbols to them.
You may recall the alternative syntax for while loops mentioned in Chapter 5. Instead of writing this< while tired do sleep end