Ruby does not run code correctly

Posted by seefour on Stack Overflow See other posts from Stack Overflow or by seefour
Published on 2012-11-30T16:39:47Z Indexed on 2012/11/30 17:04 UTC
Read the original article Hit count: 131

Filed under:

I run this basic code in Ruby (on Windows):

def hello ()
  puts 'test'
end

hello

and the Interpreter throws me this error:

app.ru:1: syntax error, unexpected tIDENTIFIER, expecting $end
hello   puts 'test'

It seems like Ruby is skipping lines? I've tried various encoding formats, other code and it still gives me an error similar to this. Why is it happening?

EDIT

The suggestions were to either use different editors or semi-colons to see if the lines were an issue. The version is also new - 1.9.3p327, so that shouldn't have been a problem. Parentheses aren't a problem either.

© Stack Overflow or respective owner

Related posts about ruby