Hi,

Am Montag, 10. Sep 2007, 12:57:36 +0900 schrieb Wilson Bilkovich:
> On 9/9/07, Luis Enrique <mail41t-now / yahoo.com> wrote:
> > I am learning Ruby.
> > This is my problem.
> > d=0
> > if some == 1..90
> > a=1
> > b=4
> > d++
> > end
> >
> > syntax error, unexpected kEND
> >
> > if I take the d++ then it is ok.
> 
> Ruby does not have pre or post-increment/decrement operators.
> d++ should be:  d += 1
> 
> Also, this probably doesn't do what you want:
> "if some == 1..90"
> I suspect you want to say:  if (1..90).include?(something)

Do yourself a favour and indent your code.

  d = 0
  if (1..90).include? d then
    a = 1
    b = 4
    d += 1
  end

There further is the === operator that is used by the case
statement. So you may say:

  d = 0
  if (1..90) === d then
    a, b = 1, 4
    d += 1
  end

or even

  d = 0
  case d
    when 1..90 then
      a, b = 1, 4
      d += 1
  end

Bertram



-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de