[ create a new paste ] login | about

Link: http://codepad.org/VlV7B58c    [ raw code | output | fork ]

Ruby, pasted on May 16:
#!/usr/bin/env ruby

def stringThisWay
  result = 'test'
  return result
end

def stringThatWay
  'test'
end

puts stringThisWay
puts stringThatWay

def hashThisWay
  result = Hash.new
  [ 'a', 'b', 'c' ].each do |var|
    result[var.to_sym] = var
  end
  return result
end

def hashThatWay
  # What here?
end

puts hashThisWay.inspect
puts hashThatWay.inspect


Output:
1
2
3
4
test
test
{:c=>"c", :a=>"a", :b=>"b"}
nil


Create a new paste based on this one


Comments: