block comment problem

Discussion in 'Ruby' started by Mrmaster Mrmaster, Dec 19, 2008.

  1. Hello,

    For some reason I'm unable to do block comments. I keep receiving this
    error in my terminal:


    timesheet.rb:20: syntax error, unexpected '=', expecting kEND
    =begin
    ^
    timesheet.rb:36: syntax error, unexpected '=', expecting kEND
    =end
    ^
    line 20 =begin
    puts "Some print statements"
    .......
    line 36 =end

    I have ubuntu 8.10 and rails 2.2.2

    Thanks
    --
    Posted via http://www.ruby-forum.com/.
    Mrmaster Mrmaster, Dec 19, 2008
    #1
    1. Advertising

  2. Mrmaster Mrmaster, Dec 19, 2008
    #2
    1. Advertising

  3. Mrmaster Mrmaster

    Dave Bass Guest

    Matz wrote:
    > "=begin" should start at the beginning of a line. You cannot indent
    > them.


    Any good reason for this?

    I suppose it must be slower for Ruby to strip leading whitespace, but
    only very slightly.

    Why would I want to indent block comments? So they're at the same
    indentation as the code I'm commenting. Keeps things neat and tidy. :)
    --
    Posted via http://www.ruby-forum.com/.
    Dave Bass, Dec 20, 2008
    #3
  4. Dave Bass wrote:
    > Matz wrote:
    >> "=begin" should start at the beginning of a line. You cannot indent
    >> them.

    >
    > Any good reason for this?
    >
    > I suppose it must be slower for Ruby to strip leading whitespace, but
    > only very slightly.
    >
    > Why would I want to indent block comments? So they're at the same
    > indentation as the code I'm commenting. Keeps things neat and tidy. :)


    It might be because of this conflict:

    x \
    =begin
    3/0
    rescue
    "div by 0"
    end

    --
    vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
    Joel VanderWerf, Dec 20, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alec S.
    Replies:
    10
    Views:
    10,062
    Alec S.
    Apr 16, 2005
  2. Xah Lee
    Replies:
    3
    Views:
    534
    Jeff Shannon
    Jan 27, 2005
  3. morrell
    Replies:
    1
    Views:
    926
    roy axenov
    Oct 10, 2006
  4. Roseanne Zhang

    Can ruby comment out a block of code???

    Roseanne Zhang, Oct 14, 2006, in forum: Ruby
    Replies:
    5
    Views:
    122
    David Vallner
    Oct 15, 2006
  5. Dan Jacobson
    Replies:
    2
    Views:
    122
    Dan Jacobson
    Sep 20, 2003
Loading...

Share This Page