J
Jigar Gosar
base_dir = "C:/pde"
def list base_dir
d= Dir.new base_dir
d.each {|x|
return "asd" if x.eql? "."
return "asd" if x.eql? ".."
puts "Got #{x}"
full_name = base_dir+"/"+x
if(File.directory?(full_name))
list full_name
end
}
end
puts ( list base_dir)
The return inside the block in the "list" method actually return from
the "list" method itself. But i just wanted to exit the block. how does
one exit from a block in ruby?
please advise.
def list base_dir
d= Dir.new base_dir
d.each {|x|
return "asd" if x.eql? "."
return "asd" if x.eql? ".."
puts "Got #{x}"
full_name = base_dir+"/"+x
if(File.directory?(full_name))
list full_name
end
}
end
puts ( list base_dir)
The return inside the block in the "list" method actually return from
the "list" method itself. But i just wanted to exit the block. how does
one exit from a block in ruby?
please advise.