LoginSignup
0
0

More than 5 years have passed since last update.

多重代入まとめ

Posted at

配列の要素を代入

a,b,c = [0,1,2]
a #=> 0 
b #=> 1
c #=> 2

文字列をスプリットして代入

str = "I am hungry.\n"
a,b,c = str.chomp.split
a #=> "I"
b #=> "am"
c #=> "hungry."
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0