Issue #13815 has been updated by opti (Andreas Opti). Subject changed from p changes scope of *vars to p args Status changed from Rejected to Open ruby -v changed from 2.4 and 2.5 to 2.5.x >If you want the same behavior, you need to use parentheses: >3.times { p((x,y = x+1,y+1)) } # ok, but also with ((...)) [most people] would assume its meaning is (x, y=x+1, y+1)... *Other example: p(x+=1,x+=1) # ok p (x+=1,x+=1) # error p ((x,y)=[x+1,y+1]) # ok p((x,y)=[x+1,y+1]) # ERROR! --- normally there should be NO space before (....) So the parsing of p(Args) might be improved... ---------------------------------------- Bug #13815: p args https://bugs.ruby-lang.org/issues/13815#change-66206 * Author: opti (Andreas Opti) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.5.x * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- x=y=0 # outside defined vars! 3.times {|i| x,y=x+1,y+1 } # as expected: x==3 3.times {|i| p(x,y=x+1,y+1) } # NOT as expected: x not changed! # x,y are the same vars as above. p shoudn't have any effect on scope -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>