From: John Feminella Date: 2011-02-17T01:01:21+09:00 Subject: Re: Why use a symbol in place of a variable? > Another way to look at it is a symbol is it is an emnumerated scalar. I don't think that's an accurate characterization, imo, since symbols have no relationship or knowledge of other symbols. They are not a collection of anything, and thus by definition can't be an enumeration. Using your example, nothing stops you from writing > my_dungeon.start(:bananas) and that would be a perfectly valid parameter to supply. However, if you wrote something like > my_dungeon.start(DungeonSizes[:bananas]) that would clue you into the problem. In this case, DungeonSizes would be more like the enumeration, into which a symbol would be the index for the element of the enumeration you wanted to select. ~ jf -- John Feminella Principal Consultant, BitsBuilder LI: http://www.linkedin.com/in/johnxf SO: http://stackoverflow.com/users/75170/ On Wed, Feb 16, 2011 at 10:34, Mike Stephens wrote: > Another way to look at it is a symbol is it is an emnumerated scalar. > > You could have > > cavesize = 345 > my_dungeon.start(cavesize) > > However if caves are only ever Small, Medium and Large, then you can > represent that finite set of options by passing :smallcave, :mediumcave > or :largecave. > > A symbol can therefore more closely represent the logic of the problem. > > -- > Posted via http://www.ruby-forum.com/. > >