From: Hiro Asari Date: 2011-11-06T21:48:59+09:00 Subject: [ruby-core:40779] [ruby-trunk - Bug #5571] Syntax Error when put String eql? with logical operation ("||") or "("&&") Issue #5571 has been updated by Hiro Asari. The || operator is binding the second test.eql? to "test", effectively turning the statement into test.eql? ("test" || test.eql?) "test1" ---------------------------------------- Bug #5571: Syntax Error when put String eql? with logical operation ("||") or "("&&") http://redmine.ruby-lang.org/issues/5571 Author: Yongjun Rong Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0dev (2011-11-04 trunk 33634) [x86_64-darwin10.8.0] There has a syntax error when try to connect two string eqls? with the logical operation ("||") and ("&&") as below {code} ruby-head :001 > test="test" => "test" ruby-head :002 > puts test.eql?("test") || test.eql?("test1") true => nil ruby-head :003 > puts test.eql?"test" || test.eql?"test1" SyntaxError: (irb):3: syntax error, unexpected tSTRING_BEG, expecting $end puts test.eql?"test" || test.eql?"test1" ^ from /usr/local/rvm/rubies/ruby-head/bin/irb:16:in `
' ruby-head :004 > puts (test.eql?("test") || test.eql?("test1")) true => nil ruby-head :005 > puts (test.eql?"test" || test.eql?"test1") SyntaxError: (irb):5: syntax error, unexpected tSTRING_BEG, expecting ')' puts (test.eql?"test" || test.eql?"test1") ^ (irb):5: syntax error, unexpected ')', expecting $end from /usr/local/rvm/rubies/ruby-head/bin/irb:16:in `
' ruby-head :006 > {code} -- http://redmine.ruby-lang.org