Use Parallel Assignment : Parallel Assignment « Language Basics « Ruby






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

 








Related examples in the same category

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