William Djaja Tjokroaminata <billtj / z.glue.umd.edu> writes:

>             if obj.nil?: puts "warning"

> I think I have minimized my typing (good for my hands)

Except the conventional Ruby syntax

              puts "warning" if obj.nil?

is actually one less keystroke, and a shifted key one that (on my
keyboard...)


It seems to me that all you've really saved is typing 'end'
keywords. If you happened to use Emacs, there's a neat function called
g0-ruby-end-block that automatically inserts the 'end' and adjusts the
indentation when you type (in my case) ALT-Return.

I've been translating some Python in to Ruby, and I'm finding that if
I use Ruby idioms, rather than just copy the code statement for
statement, the Ruby is about 10-15% fewer statements than the
equivalent Python. I'm not sure that losing the 'end's will really
make that much difference.

Cheers


Dave