Skip to content

Instantly share code, notes, and snippets.

@kdefliese
Created September 27, 2015 07:03
Show Gist options
  • Save kdefliese/c06ca283a7f4fddd65ef to your computer and use it in GitHub Desktop.
Save kdefliese/c06ca283a7f4fddd65ef to your computer and use it in GitHub Desktop.
Homework for 9/25
puts "What do YOU want now?!"
reply = gets.chomp.upcase
puts "WHAT DO YOU MEAN, #{reply}?! YOU'RE FIRED!"
puts "Table of contents".center(40)
puts
puts "Chapter 1: ".ljust(10) + "Getting started" + "page 1".rjust(11)
puts "Chapter 2: ".ljust(10) + "Letters" + "page 10".rjust(20)
puts "Chapter 3: ".ljust(10) + "Numbers" + "page 20".rjust(20)
@blip-lorist
Copy link

Nice work! Consider pulling your ljust and rjust lengths out into their own variables. That way, you only have to change the value once, rather than three times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment