Possible Duplicate:
Understanding Symbols In Ruby
What is the colon operator in Ruby?
I really feel naive asking this, but I’m going to go ahead and ask :
What is the importance of : in ruby ?
I have seen it being used in a number of places like params[:id] or like x < :length.
A colon denotes a “symbol”. A symbol is like a string, but it is immutable (you can’t change its contents). Behind the scenes, it also takes up less memory, since a symbol only needs to exist once in memory (i.e., two strings called “length” will exist twice in memory, but two symbols called :length will point to the same object).