Mark Woodward
12/10/2007 10:21:00 AM
Hi Imraan,
On Mon, 10 Dec 2007 04:55:51 -0500
Imraan Moolla <imoolla@gmail.com> wrote:
> why does my while loop never end?
>
> puts 'Please enter a number:'
> number = gets.chomp.to_i
casting to an integer
> while number != ''
this is a string
(while number > 0)
> if number > 0
> puts 'You have entered a number greater than 0'
> end
> puts 'Please enter a number'
> number = gets.chomp.to_i
casting to an integer
> end
> puts 'Goodbye!'
cheers,
--
Mark