有人可以解释这种行为:
a = b = c = 1,2,3 a # => [1,3] b # => 1 c # => 1
在赋值a = b = c = 1,3中,变量a,b和c应分配[1,3].任何的想法?
解决方法
你很困惑
a=b=c=1,3
实际上是:
a = (b = c = 1),3
离开了
c = 1 # => 1 b = c # => 1 a = 1,3 # => [1,3]