From: Matt Armstrong Date: 2002-12-16T13:48:19+09:00 Subject: Re: syntax error (Re: multi-lang support in Ruby) Shannon Fang writes: > Hi, > > The following statement will generate a syntax error: > > text.gsub!(/&#(\d+);/) do begin $1.to_i.chr rescue end; end You just have to put more semicolons in at the end of statements: text.gsub!(/&#(\d+);/) do begin $1.to_i.chr; rescue; end; end > Can anyone explain to me the general rules of when I can write code > on one line, and when I must write it on multiple lines? Maybe "statements are terminated by an end of line or a semicolon." Ruby's syntax is not "whitespace insensitive" like many other languages, but it is generally intuitive -- especially when not trying to cram too much onto one line. :-)