Skip to content

Commit

Permalink
added blocks in methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthikeyan A K committed Aug 6, 2013
1 parent 46cc76d commit 259e490
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions blocks_in_methods.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# blocks_in_methods.rb

def some_method *args, &block
p args
block.call
end

some_method 1, 3, 5, 7 do
puts "boom thata"
end
9 changes: 9 additions & 0 deletions debug.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'debugger'

def sum a, b
debugger # place this line where breakpoint is needed
c = a + b
end

puts "Sum of 3 and 5 is #{sum 3,5}"

0 comments on commit 259e490

Please sign in to comment.