I am trying to define a class constant named END like
class Test
HOME = 0
END = 1
end
This produces compiler error:
test.rb:3: parse error
END = 1
^
Is ‘END’ a reserved keyword in Ruby (‘end’ is, i know )?
Thank you,
Gennady.
I am trying to define a class constant named END like
class Test
HOME = 0
END = 1
end
This produces compiler error:
test.rb:3: parse error
END = 1
^
Is ‘END’ a reserved keyword in Ruby (‘end’ is, i know )?
Thank you,
Gennady.
BEGIN and END are reserved Ruby keywords (like ‘if’, ‘else’ and ‘while’).
You can’t use them for variables.
You can use ‘_HOME’ and ‘_END’ if you like.
Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137
On Fri, 20 Dec 2002, Gennady wrote:
I am trying to define a class constant named END like
class Test
HOME = 0
END = 1
endThis produces compiler error:
test.rb:3: parse error
END = 1
^Is ‘END’ a reserved keyword in Ruby (‘end’ is, i know )?
Thank you,
Gennady.
Thanks a lot !!!
I just checked with pickaxe and found that BEGIN and END declare blocks to
be executed on file load and program exit respectively. Sorry for not
checking before posting.
Gennady.
----- Original Message -----
From: “Daniel Carrera” dcarrera@math.umd.edu
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, December 19, 2002 2:34 PM
Subject: Re: Cannot define constant END
BEGIN and END are reserved Ruby keywords (like ‘if’, ‘else’ and ‘while’).
You can’t use them for variables.You can use ‘_HOME’ and ‘_END’ if you like.
Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137On Fri, 20 Dec 2002, Gennady wrote:
I am trying to define a class constant named END like
class Test
HOME = 0
END = 1
endThis produces compiler error:
test.rb:3: parse error
END = 1
^Is ‘END’ a reserved keyword in Ruby (‘end’ is, i know )?
Thank you,
Gennady.