[ruby] c#-like syntax and others

If I'm not mistaken I've read once about ruby's flexibility in letting
you do something your own way (there is always more than 1 way to do
something and ruby lets you choose your own way).
And yes, syntax in ruby is flexible. But there is a way to write ruby
code in c# style?
1.upto( 2 )
{ | i |
    puts i.to_s
throws error.

you have to write
1.upto( 2 ){ | i | # just one line here
    puts i.to_s
to work
It seems here isn't your way. it's just ruby way...
Or is there way I dont know to write c#-like code:
begin sign -{-
... block's code ...
end sign -}-

For short blocks, I believe it's idiomatic to do:

1.upto(2) { |i| puts i.to_s }

This also works but isn't idiomatic because it puts the '|i|' on its own line:

1.upto(2) {
   puts i.to_s

For longer blocks, it's idiomatic to use do...end:

1.upto(2) do |i|
   puts i.to_s
   # more work here...
   # and here...
   # and so on...

However, if you don't provide the opening '{' or 'do' on the same line as the 1.upto(2), you'll get an error that no block was given. I verified this in IRB (interactive Ruby) on Mac OS X w/ Ruby 1.8.5 from MacPorts.


} thanks for the reply
} i thought maybe there a way to tell ruby interpreter the new line in
} fact is not meant to be taken as a new line and that it's just for code
} layout
} 1.upto( 3 )[a sign for 'hey, ruby, it's a dummy new line here']
} { | i |
} puts i
} }

1.upto( 3 ) \
{ | i |
  puts i