title: alternate uppercase and lowercase ruby
body: <p>I'm very new to Ruby and would like to know how to automate an empty array to show the entered data to sort alphabetically and also alternate each entry between uppercase and lowercase.  I have seen similar posts on this site that describe how to accomplish this but can't seem to get this to work.</p>
  
  <p>Below is my code, and this is using the example here: <a href="https://stackoverflow.com/questions/30179990/how-to-have-the-user-input-alternate-between-uppercase-and-lowercase-in-ruby">How to have the user input alternate between uppercase and lowercase in Ruby?</a></p>
  
  <p>Currently my code first alternates the uppercase and lower case, then sorts it alphabetically (creating two lists).  What I want is just one list that is in alphabetical order and alternates the upper and lower case.  I hope this makes sense, thank you for your time! </p>
  
  <pre><code>puts "Welcome to the word list!"
  
  words = []
  
  5.times do
      puts "Please enter a word:"
      words &lt;&lt; gets.chomp
  end    
  
  words.each_with_index do |word, index|
      if index.even?
        puts word.upcase
      else
        puts word.downcase
      end
  end
  
  puts "Here are your words:"
  puts words.sort
  </code></pre>