# Ruby Newbie (ooh, that rhymes!) - When do I use do/end, when {}?

**URL:** <https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320>\
**Category:** ruby-talk\
**Created:** [1 May 2004 20:54 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320 "2004-05-01T20:54:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glenn\_M\_Smith](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@Glenn\_M\_Smith](https://rubytalk.org/u/Glenn_M_Smith)\
**Post date:** [1 May 2004 20:54 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/1 "2004-05-01T20:54:01Z")

</div>

Hello all

First some waffle as this is my first post…

I picked up on Ruby just a few days ago. Somebody in an unrelated  
thread on an unrelated forum mentioned “A Ruby programmer is a happy  
programmer”. So I decided to find out more.

My usual work is currently with Visual Basic and PL/SQL, but I like to  
have a general purpose scripting language for all those extra jobs  
that VB would be a bit too much of a sledgehammer for!

I’ve tried Perl (hateful messy syntax, gave up)  
Looked at Python… not for me  
Don’t like VBScript because of it’s “slightly different to VB” nature  
(and besides, it’s Windows-only and I use both Windows and Solaris at  
work)  
etc.

Ruby, as I’m sure you lot have already have discovered, really hits  
the spot. I read somewhere of it being called “a delightful  
language”, and it’s very true. Nice syntax, nice and clean OO  
features, everything I could want and easy to get started with. So  
please, Matz and everybody else involved, stick with it, make it even  
more feature-rich (but don’t damage the core syntax!), and let me  
throw VB away forever!!! (well, I can live in hope!).

Anyway, to my first question…

I’ve read the User Guide and other docs on the net, but I’m a little  
unsure as to whether I can ALWAYS substitute the DO/END with curly  
brackets for a block? For example, I’ve only ever seen referenced to  
hash definitions using curlies. What’s the rule here? Is it purely  
down to preference?

---

<div class="post-metadata">

**Author:** ![Jean-Hugues\_ROBERT](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jean-Hugues\_ROBERT](https://rubytalk.org/u/Jean-Hugues_ROBERT)\
**Post date:** [1 May 2004 21:06 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/2 "2004-05-01T21:06:27Z")

</div>

Welcome.  
You can always substitute the DO/END with curly brackets for a block.  
However, in some cases, you may need some extra parenthesis.  
This is due to {} having a different precedence than do/end and  
correlated impact on associativity.

And Yes, Ruby Rocks.

Yours,

Jean-Hugues

> **···**
>
> At 05:54 02/05/2004 +0900, you wrote:
> 
> > I’ve read the User Guide and other docs on the net, but I’m a little  
> > unsure as to whether I can ALWAYS substitute the DO/END with curly  
> > brackets for a block? For example, I’ve only ever seen referenced to  
> > hash definitions using curlies. What’s the rule here? Is it purely  
> > down to preference?
> 
> * * *
> 
> Web: [@jhr is virteal, virtually real](http://hdl.handle.net/1030.37/1.1)  
> Phone: +33 (0) 4 92 27 74 17

---

<div class="post-metadata">

**Author:** ![Mark\_Hubbart](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@Mark\_Hubbart](https://rubytalk.org/u/Mark_Hubbart)\
**Post date:** [1 May 2004 21:33 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/3 "2004-05-01T21:33:21Z")

</div>

While there is some amount of preference involved, there is a general  
rule that most Ruby programmers (and matz, I believe) agree on:  
brackets for one-line blocks, do…end for longer blocks. ie:

5.times {|n| puts n }

5.times do |n|  
print "bingo! " if n == 3  
puts n  
end

There are skirmishes sometimes between people who like to use all  
brackets all the time, and those who use the above method. 🙂 But this  
is the most common way, and you’ll find it mostly like that in the  
standard library.

HTH,  
–Mark

> **···**
>
> On May 1, 2004, at 1:54 PM, Glenn wrote:
> 
> > I’ve read the User Guide and other docs on the net, but I’m a little  
> > unsure as to whether I can ALWAYS substitute the DO/END with curly  
> > brackets for a block? For example, I’ve only ever seen referenced to  
> > hash definitions using curlies. What’s the rule here? Is it purely  
> > down to preference?

---

<div class="post-metadata">

**Author:** ![Mark\_Hubbart](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@Mark\_Hubbart](https://rubytalk.org/u/Mark_Hubbart)\
**Post date:** [1 May 2004 21:47 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/4 "2004-05-01T21:47:41Z")

</div>

yes, in ambiguous situations, it can require parent either way. For  
example, if you write

array.inject num.to\_f {|a,b| a \* b }

Ruby assumes you want the block to be passed to the num.to\_f method  
call. This is probably not what you want, though. To solve that one,  
put parens around the num.to\_f call:

array.inject( num.to\_f ) {|a,b| a \* b }

That will work properly. likewise, there can be similar problems with  
do…end:

obj.foo array.map do |item|  
p item  
item \* 2  
end

This snippet will hand the block to obj.foo, which is probably not what  
you want. to solve it, you could do this:

obj.foo( array.map do |item|  
p item  
item \* 2  
end )

… but that’s ugly. you would probably want to just break down and do  
it in two steps:

a = array.map do |item|  
p item  
item \* 2  
end  
obj.foo a

or convert it to a one liner:

obj.foo array.map{|item| p item; item \* 2 }

cheers,  
–Mark

> **···**
>
> On May 1, 2004, at 2:06 PM, Jean-Hugues ROBERT wrote:
> 
> > At 05:54 02/05/2004 +0900, you wrote:
> > 
> > > I’ve read the User Guide and other docs on the net, but I’m a little  
> > > unsure as to whether I can ALWAYS substitute the DO/END with curly  
> > > brackets for a block? For example, I’ve only ever seen referenced to  
> > > hash definitions using curlies. What’s the rule here? Is it purely  
> > > down to preference?
> > 
> > Welcome.  
> > You can always substitute the DO/END with curly brackets for a block.  
> > However, in some cases, you may need some extra parenthesis.  
> > This is due to {} having a different precedence than do/end and  
> > correlated impact on associativity.

---

<div class="post-metadata">

**Author:** ![Jim\_Weirich1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jim\_Weirich1](https://rubytalk.org/u/Jim_Weirich1)\
**Post date:** [1 May 2004 22:34 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/5 "2004-05-01T22:34:45Z")

</div>

Mark Hubbart wrote:

> While there is some amount of preference involved, there is a general  
> rule that most Ruby programmers (and matz, I believe) agree on: brackets  
> for one-line blocks, do…end for longer blocks. ie:

I’ve heard that general advice, and even followed it for a while. I  
finally gave up on it because many one liners grow into multiline  
blocks, and it was just annoying to switch from {} to do/end when that  
happened. Plus the style choice wasn’t conveying any additional  
information, so I dropped it and went back to a “whatever looks good” style.

Just recently I’ve been trying out the following guidelines:

o If the block returns a value, use {}  
o if the block doesn’t return a value, use do/end

So far I like the way it is turning out. The style choice helps to  
convey some of the intent of the programmer.

I offer it here for others to try. If they like it, fine. If it  
doesn’t work for you, no problem either.

> **···**
>
> ## – – Jim Weirich [jim@weirichhouse.org](mailto:jim@weirichhouse.org)[http://onestepback.org](http://onestepback.org)
> 
> “Beware of bugs in the above code; I have only proved it correct,  
> not tried it.” – Donald Knuth (in a memo to Peter van Emde Boas)

---

<div class="post-metadata">

**Author:** ![Gennady1](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@Gennady1](https://rubytalk.org/u/Gennady1)\
**Post date:** [2 May 2004 00:43 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/6 "2004-05-02T00:43:20Z")

</div>

> > I’ve read the User Guide and other docs on the net, but I’m a little  
> > unsure as to whether I can ALWAYS substitute the DO/END with curly  
> > brackets for a block? For example, I’ve only ever seen referenced to  
> > hash definitions using curlies. What’s the rule here? Is it purely  
> > down to preference?

As somebody has mentioned already it is not only preference, but also  
precedence rules ({} sticks better than do…end, meaning higher  
precedence).

> While there is some amount of preference involved, there is a general  
> rule that most Ruby programmers (and matz, I believe) agree on:  
> brackets for one-line blocks, do…end for longer blocks. ie:
> 
> 5.times {|n| puts n }

There’s also another usage some people, including myself, agree on:  
do…end for blocks that actually DO stuff, like in Array#each,  
File.open, Integer#times (Mark, sorry for contradiction ;-)), etc.; {}  
for blocks that define conditions, like in map, select/reject, sort,  
etc.

Sincerely,  
Gennady Bystritsky

> **···**
>
> On May 1, 2004, at 2:33 PM, Mark Hubbart wrote:
> 
> > On May 1, 2004, at 1:54 PM, Glenn wrote:

---

<div class="post-metadata">

**Author:** ![James\_Britt6](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@James\_Britt6](https://rubytalk.org/u/James_Britt6)\
**Post date:** [1 May 2004 23:53 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/7 "2004-05-01T23:53:40Z")

</div>

Jim Weirich wrote:

> Mark Hubbart wrote:
> 
> > While there is some amount of preference involved, there is a general  
> > rule that most Ruby programmers (and matz, I believe) agree on:  
> > brackets for one-line blocks, do…end for longer blocks. ie:
> 
> I’ve heard that general advice, and even followed it for a while. I  
> finally gave up on it because many one liners grow into multiline  
> blocks, and it was just annoying to switch from {} to do/end when that  
> happened. Plus the style choice wasn’t conveying any additional  
> information, so I dropped it and went back to a “whatever looks good”  
> style.
> 
> Just recently I’ve been trying out the following guidelines:
> 
> o If the block returns a value, use {}  
> o if the block doesn’t return a value, use do/end

{ … } means less typing, plus brace matching in Vim.

Yeah, I know that the ruby plugin for Vim will auto-type do/end for me,  
but I also find the braces visually cleaner.

James

---

<div class="post-metadata">

**Author:** ![Glenn\_M\_Smith](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@Glenn\_M\_Smith](https://rubytalk.org/u/Glenn_M_Smith)\
**Post date:** [2 May 2004 07:13 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/8 "2004-05-02T07:13:59Z")

</div>

Gennady Bystritsky [gfb@tonesoft.com](mailto:gfb@tonesoft.com) wrote in message news:[B38C9AD7-9BD1-11D8-B7CB-000A95EED88E@tonesoft.com](mailto:B38C9AD7-9BD1-11D8-B7CB-000A95EED88E@tonesoft.com)…

> There’s also another usage some people, including myself, agree on:  
> do…end for blocks that actually DO stuff, like in Array#each,  
> File.open, Integer#times (Mark, sorry for contradiction ;-)), etc.; {}  
> for blocks that define conditions, like in map, select/reject, sort,  
> etc.

And this would include curlies for hash definitions then?

I like the idea of standardising on do/end for multi-line blocks and  
curlies for single lines. That makes sense. I like the readability  
of using do/end - seems to make for nicer code.

Thanks all, you’ve helped a lot. Ruby certainly does rock!

---

<div class="post-metadata">

**Author:** ![Kristof\_Bastiaensen1](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@Kristof\_Bastiaensen1](https://rubytalk.org/u/Kristof_Bastiaensen1)\
**Post date:** [2 May 2004 10:43 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/9 "2004-05-02T10:43:58Z")

</div>

I also like to use {} when I know the block will still exist  
after the method finishes (for example in signal callbacks or  
lambda expressions).  
This way you can see clearly what belongs together.

Anyway calling it a rule I find be a bit to strong, I believe  
it is anyone’s one choice which one he/she prefers to use.

Kristof

> **···**
>
> On Sun, 02 May 2004 09:43:20 +0900, Gennady Bystritsky wrote:
> 
> > There’s also another usage some people, including myself, agree on:  
> > do…end for blocks that actually DO stuff, like in Array#each,  
> > File.open, Integer#times (Mark, sorry for contradiction ;-)), etc.; {}  
> > for blocks that define conditions, like in map, select/reject, sort,  
> > etc.

---

<div class="post-metadata">

**Author:** ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)\
**Post date:** [2 May 2004 00:47 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/10 "2004-05-02T00:47:44Z")

</div>

I agree with Jim Weirich, and would just like to point out:

- Vim will %-match do/end as well as {}
- do/end is _easier_ to type than {} in terms of wear and tear on  
my poor fingers

Gavin

> **···**
>
> On Sunday, May 2, 2004, 9:53:40 AM, James wrote:
> 
> > > Just recently I’ve been trying out the following guidelines:
> > > 
> > > o If the block returns a value, use {}  
> > > o if the block doesn’t return a value, use do/end
> 
> > { … } means less typing, plus brace matching in Vim.
> 
> > Yeah, I know that the ruby plugin for Vim will auto-type do/end for me,  
> > but I also find the braces visually cleaner.

---

<div class="post-metadata">

**Author:** ![James\_Britt6](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@James\_Britt6](https://rubytalk.org/u/James_Britt6)\
**Post date:** [2 May 2004 05:53 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/11 "2004-05-02T05:53:30Z")

</div>

Gavin Sinclair wrote:

> > Yeah, I know that the ruby plugin for Vim will auto-type do/end for me,  
> > but I also find the braces visually cleaner.
> 
> I agree with Jim Weirich, and would just like to point out:
> 
> - Vim will %-match do/end as well as {}

That’s good news. Is this in the current Rub Vim scripts? I have some  
version of ruby.vim/ruby-macros , but it does not % match do/end for me.

> - do/end is _easier_ to type than {} in terms of wear and tear on  
> my poor fingers

Ok, well how 'bout this: braces use fewer characters, so you save disk  
space.

James

> **···**
>
> > On Sunday, May 2, 2004, 9:53:40 AM, James wrote:

---

<div class="post-metadata">

**Author:** ![Claus\_Spitzer](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@Claus\_Spitzer](https://rubytalk.org/u/Claus_Spitzer)\
**Post date:** [2 May 2004 06:12 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/12 "2004-05-02T06:12:21Z")

</div>

> > - do/end is _easier_ to type than {} in terms of wear and tear on  
> > my poor fingers
> 
> Ok, well how 'bout this: braces use fewer characters, so you save disk  
> space.

Whether do/end is easier to type than {} is rather subjective… from  
personal experience, I tend towards {} because I can type {} in an  
easy stroke (hold down shift, roll fingers over { and }), and I can  
then fill in. But I digress - I’m just talking of personal experience.

To tackle the answer from a different angle - my guess is that  
programmers who come from a C/Java/Perl environment would lean towards  
{}, and programmers from a shell scripting environment may tend  
towards do/end, simply because of habit.

---

<div class="post-metadata">

**Author:** ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)\
**Post date:** [2 May 2004 12:54 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/13 "2004-05-02T12:54:51Z")

</div>

The latest CVS from [http://vim-ruby.rubyforge.org](http://vim-ruby.rubyforge.org) should provide this  
behaviour. The truly good news is that Vim 6.3 is apparently not far  
away, and it should include this.

Cheers,  
Gavin

> **···**
>
> On Sunday, May 2, 2004, 3:53:30 PM, James wrote:
> 
> > Gavin Sinclair wrote:
> 
> > > On Sunday, May 2, 2004, 9:53:40 AM, James wrote:
> > > 
> > > > Yeah, I know that the ruby plugin for Vim will auto-type do/end for me,  
> > > > but I also find the braces visually cleaner.
> > > 
> > > I agree with Jim Weirich, and would just like to point out:
> > > 
> > > - Vim will %-match do/end as well as {}
> 
> > That’s good news. Is this in the current Rub Vim scripts? I have some  
> > version of ruby.vim/ruby-macros , but it does not % match do/end for me.

---

<div class="post-metadata">

**Author:** ![Michael\_Campbell1](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@Michael\_Campbell1](https://rubytalk.org/u/Michael_Campbell1)\
**Post date:** [2 May 2004 14:33 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/14 "2004-05-02T14:33:11Z")

</div>

James Britt wrote:

> Ok, well how 'bout this: braces use fewer characters, so you save disk  
> space.

That’s easy; just use a smaller font. =)

---

<div class="post-metadata">

**Author:** ![Jean-Hugues\_ROBERT](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jean-Hugues\_ROBERT](https://rubytalk.org/u/Jean-Hugues_ROBERT)\
**Post date:** [2 May 2004 08:18 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/15 "2004-05-02T08:18:17Z")

</div>

I come from Pascal, so I tend to do/end. So you are probably right  
about the habit.

The sad thing is that this style issue really matters a lot for people.  
As a result rejecting either option is religious and accepting both is  
agnostic. Once again religion leads to war. Really sad.

Ruby: a peaceful language (and fun too).

Yours,

Jean-Hugues

> **···**
>
> At 15:12 02/05/2004 +0900, you wrote:
> 
> > > > - do/end is _easier_ to type than {} in terms of wear and tear on  
> > > > my poor fingers
> > > 
> > > Ok, well how 'bout this: braces use fewer characters, so you save disk  
> > > space.
> > 
> > Whether do/end is easier to type than {} is rather subjective… from  
> > personal experience, I tend towards {} because I can type {} in an  
> > easy stroke (hold down shift, roll fingers over { and }), and I can  
> > then fill in. But I digress - I’m just talking of personal experience.
> > 
> > To tackle the answer from a different angle - my guess is that  
> > programmers who come from a C/Java/Perl environment would lean towards  
> > {}, and programmers from a shell scripting environment may tend  
> > towards do/end, simply because of habit.
> 
> * * *
> 
> Web: [http://hdl.handle.net/1030.37/1.1](http://hdl.handle.net/1030.37/1.1)  
> Phone: +33 (0) 4 92 27 74 17

---

<div class="post-metadata">

**Author:** ![David\_A\_Black3](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@David\_A\_Black3](https://rubytalk.org/u/David_A_Black3)\
**Post date:** [2 May 2004 10:34 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/16 "2004-05-02T10:34:03Z")

</div>

Hi –

Jean-Hugues ROBERT [jean\_hugues\_robert@yahoo.com](mailto:jean_hugues_robert@yahoo.com) writes:

> > > > - do/end is _easier_ to type than {} in terms of wear and tear on  
> > > > my poor fingers
> > > 
> > > Ok, well how 'bout this: braces use fewer characters, so you save disk  
> > > space.
> > 
> > Whether do/end is easier to type than {} is rather subjective… from  
> > personal experience, I tend towards {} because I can type {} in an  
> > easy stroke (hold down shift, roll fingers over { and }), and I can  
> > then fill in. But I digress - I’m just talking of personal experience.
> > 
> > To tackle the answer from a different angle - my guess is that  
> > programmers who come from a C/Java/Perl environment would lean towards  
> > {}, and programmers from a shell scripting environment may tend  
> > towards do/end, simply because of habit.
> 
> I come from Pascal, so I tend to do/end. So you are probably right  
> about the habit.

I come from Ruby 🙂 and I find myself tending to use {} for shorter  
blocks and/or blocks that are chained:

a.select {blah}.map {blah} # etc.

partly because “do blah end.map do blah end” sort of runs together  
visually.

My instinct was always to space the dots apart in such cases:

a.select {blah} .map {blah}

though I’ve recently noticed that this isn’t done in the Ruby  
distribution, which I generally use as my style reference.

> The sad thing is that this style issue really matters a lot for people.  
> As a result rejecting either option is religious and accepting both is  
> agnostic. Once again religion leads to war. Really sad.

Heavens. I think we were just chatting about it. Here on  
ruby-talk/clr we still do that sometimes 🙂

David

> **···**
>
> > At 15:12 02/05/2004 +0900, you wrote:
> 
> –  
> David A. Black  
> [dblack@wobblini.net](mailto:dblack@wobblini.net)

---

<div class="post-metadata">

**Author:** ![James\_Britt6](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@James\_Britt6](https://rubytalk.org/u/James_Britt6)\
**Post date:** [2 May 2004 14:47 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/17 "2004-05-02T14:47:00Z")

</div>

Jean-Hugues ROBERT wrote:

> **···**
>
> > At 15:12 02/05/2004 +0900, you wrote:  
> > The sad thing is that this style issue really matters a lot for people.  
> > As a result rejecting either option is religious and accepting both is  
> > agnostic. Once again religion leads to war. Really sad.
> 
> I don’t see religion as having anything to do with this; I follow the  
> principal of IDGARA:
> 
> I Don’t Give A Rat’s Ass
> 
> James

---

<div class="post-metadata">

**Author:** ![Stephan\_Kamper3](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@Stephan\_Kamper3](https://rubytalk.org/u/Stephan_Kamper3)\
**Post date:** [2 May 2004 10:58 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/18 "2004-05-02T10:58:59Z")

</div>

Hi David, Robert & all…

David Alan Black wrote:

> Jean-Hugues ROBERT [jean\_hugues\_robert@yahoo.com](mailto:jean_hugues_robert@yahoo.com) writes:
> 
> > > > > - do/end is _easier_ to type than {} in terms of wear and tear on  
> > > > > my poor fingers

8\< snip …

> > > Whether do/end is easier to type than {} is rather subjective…

…and certainly depends on the keyboard layout. On my (German) keyboard  
for example ‘{’ is reached with [AltGr]-7 and I get ‘}’ with [AltGr]-0  
(which, IMO, isn’t too comfortable).

Nevertheless I prefer using the {} pair. Perhaps because I used C++ and  
the like before I switched to Ruby. But then, I used Pascal too (but  
loooong ago).

8\< snip …

> > The sad thing is that this style issue really matters a lot for people.  
> > As a result rejecting either option is religious and accepting both is  
> > agnostic. Once again religion leads to war. Really sad.

??? I don’t think we’re at war.

> Heavens. I think we were just chatting about it. Here on  
> ruby-talk/clr we still do that sometimes 🙂

Yes. And that’s great.

It’s a matter of personal style, preferences, hisotry, momentum (in a  
way), instinct and may be keyborad layout and (typing) lazyness.

I wouldn’t accept neither of these as a reason for war, heatet debates  
or anything like that.

I like programming, I like Ruby - I combine these and be happy.  
(And I somewhat like the idea of taoism, which you might have noticed…)

Happy rubying

Stephan

> **···**
>
> > > At 15:12 02/05/2004 +0900, you wrote:

---

<div class="post-metadata">

**Author:** ![Mark\_Hubbart](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@Mark\_Hubbart](https://rubytalk.org/u/Mark_Hubbart)\
**Post date:** [2 May 2004 12:06 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/19 "2004-05-02T12:06:46Z")

</div>

I admit, I hadn’t realized the situation was a complex as it is. I had  
seen where people used only brackets, so I mentioned that, not knowing  
how many different styles I was leaving out 🙂 It’s probably because  
I’ve only been here a few months, and haven’t seen all the discussion.  
Still, it’s very interesting to me to hear all the different rules  
people use for their code blocks.

A very informative thread for me. I _hope_ it didn’t sound like a flame  
war 🙂

–Mark

> **···**
>
> On May 2, 2004, at 3:34 AM, David Alan Black wrote:
> 
> > > The sad thing is that this style issue really matters a lot for  
> > > people.  
> > > As a result rejecting either option is religious and accepting both is  
> > > agnostic. Once again religion leads to war. Really sad.
> > 
> > Heavens. I think we were just chatting about it. Here on  
> > ruby-talk/clr we still do that sometimes 🙂

---

<div class="post-metadata">

**Author:** ![Paul\_Vudmaska](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@Paul\_Vudmaska](https://rubytalk.org/u/Paul_Vudmaska)\
**Post date:** [2 May 2004 16:01 UTC](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320/20 "2004-05-02T16:01:40Z")

</div>

James Britt wrote:

> Jean-Hugues ROBERT wrote:
> 
> > The sad thing is that this style issue really matters a lot for people.  
> > As a result rejecting either option is religious and accepting both is  
> > agnostic. Once again religion leads to war. Really sad.
> 
> I don’t see religion as having anything to do with this; I follow the  
> principal of IDGARA:
> 
> I Don’t Give A Rat’s Ass
> 
> James

VIAGRA

Valuing  
Independent  
Analysis  
Generally  
Raises  
Awareness

Even if you dont give a crap about the conclusion

> **···**
>
> > > At 15:12 02/05/2004 +0900, you wrote:

[Next page](https://rubytalk.org/t/ruby-newbie-ooh-that-rhymes-when-do-i-use-do-end-when/11320.md?page=2)
