|
|
|
|
|
by greenpeas
1434 days ago
|
|
> > `do_thing if other_thing` > Yeah I don't get why you would deliberately make the flow control confusing and backwards like that. I like to use this as function guards, where the first lines in the body of a function can be: return xxx if some_edge_condition?
example: https://github.com/rails/rails/blob/f95c0b7e96eb36bc3efc0c5b... |
|
(Ending boolean-returning methods with a ? is also a great convention in ruby.)