From: Nobuyoshi Nakada Date: 2011-11-09T14:44:17+09:00 Subject: [ruby-core:40875] [ruby-trunk - Bug #5571][Rejected] Syntax Error when put String eql? with logical operation ("||") or "("&&") Issue #5571 has been updated by Nobuyoshi Nakada. Category set to core Status changed from Open to Rejected Yes, because command call (method call without parentheses) has lower precedence than || operator. ---------------------------------------- Bug #5571: Syntax Error when put String eql? with logical operation ("||") or "("&&") http://redmine.ruby-lang.org/issues/5571 Author: Yongjun Rong Status: Rejected Priority: Normal Assignee: Category: core 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