Hi sir Nobu,
You suggested awhile back:
And regarding original post,
open(“test”) do |f|
4.times {f.readline}
f.each {|line| p line}
end
I’ve made a function to make the code generic like:
def Fp (file,skip)
File.open(file) do |f|
skip.times {f.readline}
f.each { |line| p line }
^^^^^^^^^^^^^^^^^^
end
end
The each block isn’t generic (note underscored). I want to pass my own block
for each. How do I do that? Maybe my approach is wrong? Sorry, I cannot find
samples…
Nobu Nakada
Best regards,
-botp