Imagine that you want to save text back to a file, but only if it changed:

if str.upcase! then File.open('x.txt','w'){|f| f.write str} end

-----Original Message-----
From: HarryO [mailto:harryo / zipworld.com.au]
Sent: Saturday, January 05, 2002 2:35 PM
To: ruby-talk ML; undisclosed-recipients:
Subject: [ruby-talk:30311] Re: Ruby article on Freshmeat


I was in the middle of writing almost exactly what you said, because
I was interleaving my response with your text :-).

So as not to waste the post, I'll make the point that I seem to recall
there being a thread that discussed why the "!" operators return nil
if they don't change the object

Unfortunately, I can't remember what the rationale was.  Can someone
point me to the thread or just remind me what the gist was?