var = Array(1) # => [1] var = *1 # => [1] # * is the same as Array var = Array([1,2,3]) #=> [1,2,3] var = *[1,2,3] #=> [1,2,3] # its useful when we need array like var = [var] unless var.is_a? Array var = [var].flatten # we can write var = *var # => [var] # but can't *var # => syntax error
Monday, July 1, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment