Expressions and Operator
#method invocations
puts "hello world" #"puts" invoked on self , with one string arg
puts Math.sqrt(2) #"sqrt" invoked on object Math with one arg
message="hello world"
puts message.length #"length" invoked on object message;no args
a=[0,1,2,3]
a.each {|x| p x} #"each"invoked on object a,with an associated block
return
hello world
1.4142135623730951
11
0
1
2
3
#Assigning to attributes and array elements
#o[x]=y same as o.=(x,y)
#Abbreviated assignment
#these two expressions are equivalent:
#o[x]-=2
#o.=(x,o.[]=(x)-2)
x=[1,2] #x becomes[1,2]:this is not parallel assignment
x,=[1,2] #x becomes 1:the trailing comma makes it parallel
#splat operation