为什么分配的值多于变量的数量不会出错?
Why does assigning more values than the number of variables not give an error?
我为较少数量的变量赋值:
a, b ,c= 2, 3,4,5
为什么不显示错误?
If you have more values on the right hand side of the assignment than variables on the left hand side the extra values are ignored. You can use *
to gather extra values on the right-hand side of the assignment. The *
can appear anywhere on the left-hand side. But you may only use one *
in an assignment.
我为较少数量的变量赋值:
a, b ,c= 2, 3,4,5
为什么不显示错误?
If you have more values on the right hand side of the assignment than variables on the left hand side the extra values are ignored. You can use
*
to gather extra values on the right-hand side of the assignment. The*
can appear anywhere on the left-hand side. But you may only use one*
in an assignment.