From: Vicente Bosch Campos Date: 2010-11-10T07:58:05+09:00 Subject: Re: help with code, new to programming Hi Steve, The main loop of the game would be as follows: print 'I am going to test if you are psychic, press enter to continue...' initialise = gets reply='yes' while reply=='yes' matches = ask 'I am thinking of a number between 1 and 10, can you guess what it is?' puts 'As to the question of you being psychic the answer is:' puts matches puts 'Would you like to play again? (please answer yes or no' reply = gets.chomp end puts 'Goodbye and farewell...' Probably there is a more idiomatic way of doing it and also you should check better for the inputed value from the user ( something to investigate for you in the future). Regards, V. On Nov 9, 2010, at 11:31 PM, Steve Rees wrote: > print 'I am going to test if you are psychic, press enter to > continue...' > initialise = gets > matches = ask 'I am thinking of a number between 1 and 10, can you guess > what it is?' > puts 'As to the question of you being psychic the answer is:' > puts matches > puts 'Would you like to play again? (please answer yes or no' > reply = gets.chomp > if reply == 'yes' > matches = ask 'I am thinking of a number between 1 and 10, can you guess > what it is?' > else > puts 'Goodbye and farewell...' > end