From: zuzu Date: 2004-07-09T21:12:58+09:00 Subject: Re: I love Ruby On Fri, 9 Jul 2004 21:02:32 +0900, gabriele renzi wrote: > il Fri, 09 Jul 2004 12:51:27 +0100, Graham Nicholls > ha scritto:: > > >I didn't even know there was a {} ! > >Documentation (up to date) would seem to be a minor problem with ruby - am I > >being reasonable ? (To be fair, I've yet to read my 2 books from cover to > >cover, so I've probably missed it.) For instance, I believe theres no 1.8 > >documentation. I'm still in love, though ;-) http://www.rubycentral.com/book/ it feels a bit like "v1.0" documentation and tends to be a bit too "for tradtional programmers" as a bridge to the ruby way of thinking for my tastes. (i'd rather be explained the "accepted style" upfront, personally.) but it is by far one of the best books on howto programming, let alone learning ruby, i've read. some where in there it explains about begin...end, then iirc talks about blocks, then explains about { }. i would lump that together, personally, but that's the "v1.0" thing. p.s. the "pragmatic programmers" are pretty on the ball about improving the process of programming; their other book is worth reading as well. > you're reasonable but not in this thing. > blocks in ruby are in the form: > > amethod do |vars| > body > end > > or > > amethod { |vars| > body > } > > this is the only place where {} are used as syntax delimiters, and the > common idiom is to use do..end for multiline stuff, and {..} for > one-line blocks. > > You can't use them in place of begin..end, like: > > begin > print 10 > end while true > > { > print 10 > } while true > >