Ruby/Language Basics/Parallel Assignment

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск

assign values of different kinds, such as a string, float, and integer:

a, b, c = "cash", 1.99, 100



Use Parallel Assignment

Parallel Assignment is a way to assign a group or series of variables in one statement
x = 100
y = 200
z = 500
#With parallel assignment, you do the same thing by separating the variables, then the values, with commas:
x, y, z = 100, 200, 500