4 ms·
I don't believe the second one works. Usually you'd define a method using: def some_method # do something end Usually you'll only use do after a metho
by djacobs 16y ago
I don't believe the second one works. Usually you'd define a method using:
def some_method
# do something
end
Usually you'll only use do after a method that's already defined, in order to pass a block of code to it.
- steveklabnik 16y agoYou are correct: ruby-1.9.2-p0 > def something; "hey" end => nil ruby-1.9.2-p0 > something => "hey" Adding the do makes it not work. def doesn't have a do.