On error resume next

conn = tcpserver.connect(remote) rescue conn = nil
f = File.open(testfile) rescue f = nil

vs.

conn = tcpserver.connect(remote) rescue nil
f = File.open(testfile) rescue nil

Yes, you can do exactly what you did, but I find that the way that I did it is less obfuscated and clearer on intent.

-a

Hi –

···

On Sat, 7 Dec 2002, Austin Ziegler wrote:

conn = tcpserver.connect(remote) rescue conn = nil
f = File.open(testfile) rescue f = nil

vs.

conn = tcpserver.connect(remote) rescue nil
f = File.open(testfile) rescue nil

Yes, you can do exactly what you did, but I find that the way that I
did it is less obfuscated and clearer on intent.

Sorry, I just have to chuckle over the idea that either of these is
obfuscated or unclear.

Ruby has definitely spoiled us! :slight_smile:

David


David Alan Black
home: dblack@candle.superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav

conn = tcpserver.connect(remote) rescue conn = nil
f = File.open(testfile) rescue f = nil

vs.

conn = tcpserver.connect(remote) rescue nil
f = File.open(testfile) rescue nil

Yes, you can do exactly what you did, but I find that the way that I did it
is less obfuscated and clearer on intent.

Oh well, fair enough. I really like the latter. It fits with the

f = x || y

idiom.

-a

Gavin

···

From: “Austin Ziegler” treo@halostatue.ca