A symbol always has a : in front of its name, usually followed by a non-quoted string, e.g. :pullo
They are also immutable. Their value remains constant during the entirety of the program and they never appear on the left side of an assignment.
In the above example, I think you’re probably getting confused with the arguments you are passing to the add
method.
As of Ruby 1.9 hashes can be declared using a new syntax.
Ruby 1.8 syntax:
{:key1 => "value1", :key2 => "value2"}
Ruby 1.9 syntax:
{key1: "value1", key2: "value2"}
So this:
puts add(1.0134, -5.568, absolute: true)
Could also be written like this:
puts add(1.0134, -5.568, :absolute => true)
and this:
puts add(1.0134, -5.568, absolute: true, round: true, precision: 2)
could also be written like:
puts add(1.0134, -5.568, :absolute => true, :round => true, :precision => 2)
In short: symbols always have a : in front of them. You are getting confused with the new Hash syntax introduced in Ruby 1.9
Further reading: http://logicalfriday.com/2011/06/20/i-dont-like-the-ruby-1-9-hash-syntax/