DEV Community

Discussion on: Ruby and Bang(s)

Collapse
 
kinduff profile image
Alejandro AR • Edited

Good article.

Keep in mind that both method! and method? in ruby methods are a convention and not a ruby functionality per se, and it's different of the !method and !!method in the context of a boolean return. Something curious though: !true === true.!.

Talking about the convention, when I define methods I usually define them with ! if the action is going to modify the object it's called on, or if it's going to raise an exception if something goes wrong. For the ?, the convention is that it will return a boolean.

PS: I love Ruby.