Tuesday, May 1, 2012

multiple assignment

 a, b, c = 1, 2  
 print(a, b, c) --> 1 2 nil  
   
 a, b = a+1, b+1, b+2 -- value of b+2 is ignored  
 print(a, b) --> 1 2  
   
 a, b, c = 100  
 print(a, b, c) --> 100 nil nil  

No comments:

Post a Comment