Why am I not getting the expected output?

I have the following code: http://pastie.org/1032525, but always getting
‘Book written’ as output at the time I have to get ‘Software operating’
instead. What am I missing here?

Thanks.

On Tuesday 06 July 2010, Abder-rahman Ali wrote:

|I have the following code: http://pastie.org/1032525, but always getting
|‘Book written’ as output at the time I have to get ‘Software operating’
|instead. What am I missing here?
|
|Thanks.

It works correctly for me

Stefano

Did you change the ‘===’ operator maybe?
Have you been overwriting the Fixnum class?

El mar, 06-07-2010 a las 21:52 +0900, Abder-rahman Ali escribió:

Stefano C. wrote:

On Tuesday 06 July 2010, Abder-rahman Ali wrote:

|I have the following code: http://pastie.org/1032525, but always getting
|‘Book written’ as output at the time I have to get ‘Software operating’
|instead. What am I missing here?
|
|Thanks.

It works correctly for me

Stefano

Really amazing.

Did you run it as is?

It is not actually yet working for me.

On Tuesday 06 July 2010, Abder-rahman Ali wrote:

|> Stefano
|
|Really amazing.
|
|Did you run it as is?

Yes. I just copied it and pasted into a file.

|It is not actually yet working for me.

I can’t think of a reason. Are you sure it’s exactly the same code you
posted?

Stefano

Juan José Vidal wrote:

Did you change the ‘===’ operator maybe?
Have you been overwriting the Fixnum class?

El mar, 06-07-2010 a las 21:52 +0900, Abder-rahman Ali escribió:

Even if I change it to this I still get the same output:
http://pastie.org/1032617

When you look at the logic it is correct, but why NOT getting what
happened in 1995, and always getting what happened in 1990, I’m really
confused.

Abder-rahman Ali wrote:

Juan José Vidal wrote:

Did you change the ‘===’ operator maybe?
Have you been overwriting the Fixnum class?

El mar, 06-07-2010 a las 21:52 +0900, Abder-rahman Ali escribió:

Even if I change it to this I still get the same output:
http://pastie.org/1032617

When you look at the logic it is correct, but why NOT getting what
happened in 1995, and always getting what happened in 1990, I’m really
confused.

Sorry, the modified version I mentioned earlier:
http://pastie.org/1032624

Gives me the following error:

whathappened.rb:3: syntax error, unexpected kIF, expecting kWHEN
if 1990 === year
^

Any idea on this?

Thanks.

Stefano C. wrote:

On Tuesday 06 July 2010, Abder-rahman Ali wrote:

|> Stefano
|
|Really amazing.
|
|Did you run it as is?

Yes. I just copied it and pasted into a file.

|It is not actually yet working for me.

I can’t think of a reason. Are you sure it’s exactly the same code you
posted?

Stefano

Thanks Stefano. I went ahead and copied-pasted the code I have submitted
and it works :slight_smile:

Seems that I had two versions, and was running the wrong version :slight_smile:

Thanks a lot.

On Tuesday 06 July 2010 15:22:52, Abder-rahman Ali wrote:

whathappened.rb:3: syntax error, unexpected kIF, expecting kWHEN
if 1990 === year
^

Simple syntax error – you have a stray “case” statement still in your
file,
so ruby expects at least one “when” clause following (kWHEN), but
instead
encounters an “if” clause (kIF).

  Eric

Eric MSP Veith wrote:

On Tuesday 06 July 2010 15:22:52, Abder-rahman Ali wrote:

whathappened.rb:3: syntax error, unexpected kIF, expecting kWHEN
if 1990 === year
^

Simple syntax error – you have a stray “case” statement still in your
file,
so ruby expects at least one “when” clause following (kWHEN), but
instead
encounters an “if” clause (kIF).

  Eric

Thanks a lot Eric.

Thanks a lot everyone for their replies on this.