6.3. ConclusionIn this chapter we've seen what symbols are in Ruby and how they are used. We've seen both standard and user-defined uses of symbols. We've also looked at ranges in depth. We've seen how to convert them to arrays, how to use them as array or string indices, how to iterate over them, and other such operations. We've looked in detail at the flip-flop operator (and an alternative to the old syntax). Finally we've seen in detail how to construct a class so that it works well with range operators. That ends our discussion of symbols and ranges. But as they are commonly used in Ruby (and are extremely useful), you'll see more of them both in incidental code throughout the rest of the book. |