From: Gregory Seidman Date: 2006-04-30T22:14:54+09:00 Subject: Re: how to use curly brackets vs. 'end' in Ruby carlo wrote: } 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: [...] } 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? In general, the answers you've been getting are along the lines of "you can't do that" or "that isn't the Ruby way" and, strictly speaking, both are accurate. That said, there's sort of a way to do it for methods, at least: class << Object alias defm define_method end class Foo defm(:bar) { |baz| puts baz } end x = Foo.new x.bar('Whee!') So, yeah, it isn't perfect, but if you *really* want that C syntax feel, that's about as close as you're going to get. > Thanks! --Greg -- Posted via http://www.ruby-forum.com/.