From: Brian Candler Date: 2012-09-07T04:26:21+09:00 Subject: Re: Subtraction, union and intersection of arrays in Ruby Joao Silva wrote in post #1074949: > Here is a little tricky, and not calculated well it doesn't even *parse*: $ ruby ert.rb ert.rb:5: syntax error, unexpected '!', expecting kEND op_sys if [i]! = linux_sys [i] ^ ert.rb:6: syntax error, unexpected '=', expecting kEND subtraction = [i] = op_sys [i] ^ ert.rb:8: syntax error, unexpected kEND, expecting $end First make your program syntactically valid. Then you can see if it works or not. Note: the error message "unexpected kEND, expecting $end" is not a very good message. What it should say is "unexpected 'end', was expecting end-of-file" That is, there is one too many 'ends' in your program. Hint: a statement like foo if bar == baz is a single complete statement. It does *not* want a matching 'end' statement. It means "if bar == baz, do foo" But if you write it the other way: if bar == baz foo end this means the same, but *does* have a matching 'end' statement. -- Posted via http://www.ruby-forum.com/.