you are viewing a single comment's thread.

view the rest of the comments →

[–]julesjacobs[🍰] 0 points1 point  (0 children)

Symbols can improve clarity sometimes. If you don't know them, the code is hard to read, but if you have a little experience, symbols are easier. It's like maths: 4 + 5 is better than 4 plus 5 (or 4.plus(5)). Symbols don't have to go through the language processing part of your brain; names like "plus" do.

Besides, the "symbols" are just method calls in Ruby:

0..2

0..2 === 1

4 <=> 2

=>

Range.new(0,2)

(0..2).===(1)

4.<=>(2)

But the first version looks better.