The rails team and many other rubyists prefer to use curly braces for one line blocks and do...end
for multi-line ones.
The only functional difference between the two is that the precedence of a do...end
block is lower than that of a {...}
block.
More Related Contents:
- Using do block vs braces {}
- Ruby Style: How to check whether a nested hash element exists
- Is it good style to explicitly return in Ruby?
- When to use each method of launching a subprocess in Ruby
- Can’t output currency in ruby with money-gem [closed]
- Very Basic Ruby puts and gets
- What does map(&:name) mean in Ruby?
- What does the (unary) * operator do in this Ruby code?
- How to sort an array in descending order in Ruby
- How to debug Ruby scripts [closed]
- Why can I refer to a variable outside of an if/unless/case statement that never ran?
- diff a ruby string or array
- How to break outer cycle in Ruby?
- Difference between DateTime and Time in Ruby
- What does send() do in Ruby?
- How does the magic comment ( # Encoding: utf-8 ) in ruby work?
- Why does Ruby seem to hoist variable declarations from inside a case statement even if that code path is not executed? [duplicate]
- Need a simple explanation of the inject method
- Office 365 Rest API – Daemon week authentication
- Access variables programmatically by name in Ruby
- How do I temporarily redirect stderr in Ruby?
- Confusion with Atomic Grouping – how it differs from the Grouping in regular expression of Ruby?
- Extract number from string in Ruby
- Using layouts in HAML files independently of Rails
- How to implement a short URL like the URLs in Twitter?
- ‘||=’ operator in Ruby
- Ruby: Installing rmagick on Ubuntu
- Better ruby markdown interpreter?
- How to understand the difference between class_eval() and instance_eval()?
- What is the best way to split a string to get all the substrings by Ruby?