Last Updated: February 25, 2016
·
693
· 8xx8ru

Multiple Assignment tricks

# Basic Usage
a, b, c = [1, 2, 3]  # a = 1; b = 2; c = 3;
a, b, c = [1, 2]     # a = 1; b = 2; c = nil;

# Advansed Usage
list = [1, 2, 3]
a, *b = list         # a = 1; b = [2, 3];
*b, c = list         # b = [2, 3]; c = 2;