Skip to content

Instantly share code, notes, and snippets.

@kdefliese
Created September 27, 2015 19:40
Show Gist options
  • Save kdefliese/842661c30916e1663517 to your computer and use it in GitHub Desktop.
Save kdefliese/842661c30916e1663517 to your computer and use it in GitHub Desktop.
Homework for 9/25
words = []
word = "string"
while word != ""
puts "Enter a word! Or just hit enter when you are finished entering words!"
word = gets.chomp
words.push(word)
end
puts "#{words.sort}"
my_array = ["Table of contents","Chapter 1: ","Getting started","page 1","Chapter 2: ","Letters","page 10","Chapter 3: ","Numbers","page 20"]
puts my_array[0].center(40)
puts
puts my_array[1].ljust(10) + my_array[2] + my_array[3].rjust(11)
puts my_array[4].ljust(10) + my_array[5] + my_array[6].rjust(20)
puts my_array[7].ljust(10) + my_array[8] + my_array[9].rjust(20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment