Ruby - Array addition and Concatenation

Introduction

If you have two arrays, you can quickly combine their results into one:

Demo

x = [1, 2, 3] 
y = ["a", "b", "c"] 
z = x + y #  w w  w. j  a va  2s .  c  o m
p z

Result

We're using p here instead of puts z.inspect.

Related Topics