From: carlo Date: 2006-04-29T03:27:46+09:00 Subject: how to use curly brackets vs. 'end' in Ruby 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 Or what about this: def fib(n) { if (n<2) { n } else { fib(n-2)+fib(n-1) } } print(fib(20), "\n"); 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? Thanks! -- Posted via http://www.ruby-forum.com/.