0

Does anyone think readability is affected when a method is called without parentheses in Ruby

8th Jul 2017, 7:09 PM
Richard Opoku
Richard Opoku - avatar
2 odpowiedzi
+ 2
Yes, leave them in.
8th Jul 2017, 8:11 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
Depends. I don't use parentheses usually. Ruby is beautiful enough and doesn't hamper the readability in most cases. Example, def sum a,b a+b end sum 1,2 # allowed, doesn't seem as a hassle. But, there are some cases you definitely should use parentheses. eg, if the method takes quite a number of arguments, or if you're printing the return value puts sum 1,2 # discouraged You should read the ruby style guide, as it's designed for maximum efficiency. https://github.com/bbatsov/ruby-style-guide
8th Jul 2017, 8:31 PM
Salekin
Salekin - avatar