If you don't like the 'end'.. well I don't like the 'do' :-)

Not really, it's just that it would be much more readable to have also
'is' and maybe some other keyword to delimit blocks.

On 4/28/06, Robert Klemme <shortcutter / googlemail.com> wrote:
> 2006/4/28, carlo <cdicelico / earthlink.net>:
> > i dislike the use of 'end' (just about the only think i *don't* like in
> > ruby). so, since everybody is saying that this is just a matter of
> > taste, why won't this work:
> >
> > class Hello
> > {
> > attr_reader :msg
> > def initialize
> > {
> > @msg = "Hello, World"
> > }
> > }
> > h = Hello.new
> > puts h.msg
> > print "Press RETURN"
> > $stdin.gets
>
> Because it's syntactically not permitted.  Note that {...} can only
> replace do...end.
>
> > Or what about this:
>
> same.
>
> > in other words, i'm more comfortable with {} coming from C,C++, & C# so
> > what are the precise syntax rules for substituting {} for 'end'? is
> > there anything wrong with how i structured my code above? I keep getting
> > syntax errors & "odd number list for Hash" errors, & i'm pretty sure it
> > has something to do with my syntax, since both of these work in their
> > original form (using 'end'). obviously, ruby thinks i'm trying to create
> > a hash. so, how can i use {} instead of 'end' w/o confusing ruby?
>
> http://ruby-doc.org/docs/ProgrammingRuby/html/intro.html#S6
>
> Kind regards
>
> robert
>
> --
> Have a look: http://www.flickr.com/photos/fussel-foto/
>
>


--
Chiaroscuro
---
Liquid Development: http://liquiddevelopment.blogspot.com/