Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

How to set amount space to the right in string Ruby

Hello guys, I tried a simple program with hash, and i wanna display it like a data table in the console.

I wanna make something like this

----------------------------------------------------------------
ID     Name                    Score
----------------------------------------------------------------
<<DATA BELOW >>

In VB.NET I could set it Console.WriteLine("{0, -5}, {1, -20}, {2, -20}", "ID", "Name", "Score")

The negative number specify the amount of space to the right, I already used \t escape character in Ruby, but is it available in Ruby like VB.NET does?

puts "ID\tName\t\t\t\tCost\t\t\tDescription"
puts "-" * 80