Skip to content

Instantly share code, notes, and snippets.

@ready4god2513
Created November 29, 2010 23:40
Show Gist options
  • Save ready4god2513/720844 to your computer and use it in GitHub Desktop.
Save ready4god2513/720844 to your computer and use it in GitHub Desktop.
operator = "t"
number = Integer("2")
if operator =~ /^t/
calc = -> n { n * number }
else
calc = -> n { n + number }
end
puts (1..10).collect(&calc).join(", ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment