Inspect an Array of Variables

Most likely, everyone’s been doing this forever but I just figured it out:

i = 1
want = "want"
to = 2
see = :inspect
lots = 1..100
of, variables, at, once = "of variables at once".split

puts "Generally, I prefer this:"
puts [i, want, to, see, lots, of, variables, at, once].inspect

puts "\ninstead of this:"
puts i, want, to, see, lots, of, variables, at, once
Generally, I prefer this:
[1, "want", 2, :inspect, 1..100, "of", "variables", "at", "once"]

instead of this:
1
want
2
inspect
1..100
of
variables
at
once

It’s a handy shortcut which I discovered while porting a Python project to Ruby recently, which involved lots of manual debugging.

it, works, for_python, too = range(0,4)

print(it, works, for_python, too)