I'm fairly new to Ruby, puzzling the value of:

def sub1(x)
   yield 5 * x
end

sub1(2) {|y| puts 3 * y }    #=> 30

.... over:

def sub2(x)
   y = 5 * x
   puts 3 * y
end

sub2(2)   #=> 30

Isn't there the danger,  with passing code blocks, that half of your 
method/function/sub definition is hanging somewhere else in your code 
making it difficult to keep track of exactly what it does? How can I 
debug a method if I don't know what else it's composed of until it is 
called?

gvim