On Tue, Jan 10, 2012 at 1:51 PM, Luke D. <crazybuzz100 / gmail.com> wrote: > Hi Ruby world! > > Just thought I'd post my first Ruby program and say hi. > > I'm a classical pianist/vocalist and have to learn Sol-fa as part of my > aural work at UNI. > This is my first stab at making a program of any use to me, quite > exciting! > > If anyone has some suggestions (features, simplify code, bad commenting > etc.) it would be good if I knew now before I delved deeper into the > Ruby world! > > The program asks the user how many notes he wants to sing, then randomly > chooses those notes from a hash. The idea is that the user then sings > the Sol-fa presented to them on the screen. > > (I assume I posted this in the right place?) > > Attachments: > http://www.ruby-forum.com/attachment/6894/SolFa.rb Welcome to Ruby ! It's actually a quite good first program, congratulations. There are a couple of minor things I would change: A Hash whose keys are numbers like an index (they don't have inherent meaning) resembles too much an Array. In this example I can't see why that hash cannot be an Array: notes = %w{Doh Ray Me Fah Soh Lah Te} and change the random to notes[rand(notes.length)] Also, what the user types is always a number for you, so just transform it the first time, instead of every time you use it: how_many = gets.to_i Now you don't need the to_i every time you use it. Other than that, good work ! Jesus.