Guest User

Untitled

a guest
Apr 24th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. title = "Table of Contents"
  2.  
  3. bookinfo = ["Numbers", 1, "Letters", 72, "Variables", 118]
  4. width = 50
  5. puts bookinfo.join(", ")
  6. puts title.center(width)
  7.  
  8. 3.times do |ch|
  9. puts(("Chapter #{(ch + 1).to_s}: " + bookinfo[2*ch].to_s).ljust(width/2) + ("page " + bookinfo[(2*ch)+1].to_s).rjust(width/2))
  10. end
Add Comment
Please, Sign In to add comment