Ruby/Language Basics/Parallel Assignment
Материал из Wiki.crossplatform.ru
(Различия между версиями)
ViGOur (Обсуждение | вклад) м (1 версия: Импорт выборки материалов по Ruby) |
Текущая версия на 17:59, 13 сентября 2010
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