"1 1 2 3 5 8 13 21".split.map(&:to_i) # => [1, 1, 2, 3, 5, 8, 13, 21] # 多重代入との組み合せ w, h = "30 35".split.map(&:to_i) Register as a new user and use Qiita more conveniently You get articles that match your needsYou can efficiently read back useful informationYou can use dark themeWhat you can do with signing up