From: Ted Date: 2002-11-18T13:54:12+09:00 Subject: Re: Read a file... Arrange things that depend on the previous result to be in one bre block. Does the rescue statement serve as a catch-all (for possible fuzzy thinking)? Is normal|abnormal termination processing built into the language? If all this is built into Ruby it's the greatest thing since sliced bread; else it's (yet) another fad language. end So, -- for me -- Ruby is a whole new way of thinking. I'll get it -- because it is fun to learn new things. But it is a radical departure from what I've done for um, ..., over 3 days -- and I have the grey hare to prove it. So there. > Well, if you can't open the file, then you can't read the file content > and you don't need to close the file. If reading the SQL query from > the file fails, the you can't issue SQL statement because you don't > have the query. > > Thus, it's perfectly alright to put all those within one > begin-rescue-end (bre) block: > > begin > File.open("dfsf"){|f| query << f.readlines.to_s} > sqlStatement = query > dbh.execQuery(sqlStatemetn) > . > . > . > all other dbh-related activity > . > . > . > rescue Exception=>e > p e > end > > Thus, you don't need to do bre block everytime you do > something. Arrange things that depend on the previous result to be in > one bre block.