# New to ruby

**URL:** <https://www.ruby-forum.com/t/new-to-ruby/122644>\
**Category:** Ruby\
**Created:** [December 10, 2007, 10:55am UTC](https://www.ruby-forum.com/t/new-to-ruby/122644 "2007-12-10T10:55:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![imoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@imoo](https://www.ruby-forum.com/u/imoo)\
**Post date:** [December 10, 2007, 10:55am UTC](https://www.ruby-forum.com/t/new-to-ruby/122644/1 "2007-12-10T10:55:53Z")

</div>

why does my while loop never end?

puts ‘Please enter a number:’  
number = gets.chomp.to\_i  
while number != ‘’  
if number \> 0  
puts ‘You have entered a number greater than 0’  
end  
puts ‘Please enter a number’  
number = gets.chomp.to\_i  
end  
puts ‘Goodbye!’

---

<div class="post-metadata">

**Author:** ![imoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@imoo](https://www.ruby-forum.com/u/imoo)\
**Post date:** [December 10, 2007, 11:20am UTC](https://www.ruby-forum.com/t/new-to-ruby/122644/2 "2007-12-10T11:20:02Z")

</div>

From: Imraan M. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

# why does my while loop never end?

check your while condition, pls.

# puts ‘Please enter a number:’

# number = gets.chomp.to\_i

number is an integer

# while number != ‘’

then you’re comparing it w a string

---

<div class="post-metadata">

**Author:** ![imoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@imoo](https://www.ruby-forum.com/u/imoo)\
**Post date:** [December 10, 2007, 11:21am UTC](https://www.ruby-forum.com/t/new-to-ruby/122644/3 "2007-12-10T11:21:48Z")

</div>

Hello,

Is there any other source where I could download the gem  
activerecord-sybase-adapter.

I have been trying to access [http://gems.rubyonrails.org](http://gems.rubyonrails.org) all day, which  
hosts these adapters according to  
[Ruby on Rails — Adapter gems available](http://weblog.rubyonrails.org/2007/10/1/adapter-gems-available) but to no  
avail.

[http://gems.rubyforge.net](http://gems.rubyforge.net) didn’t yield anything either.

I am upgrading to rails 2.0 and this is holding me back.

Many Thanks,  
Aman

* * *

* * *

This message is intended only for the personal and confidential use of  
the designated recipient(s) named above. If you are not the intended  
recipient of this message you are hereby notified that any review,  
dissemination, distribution or copying of this message is strictly  
prohibited. This communication is for information purposes only and  
should not be regarded as an offer to sell or as a solicitation of an  
offer to buy any financial product, an official confirmation of any  
transaction, or as an official statement of Lehman Brothers. Email  
transmission cannot be guaranteed to be secure or error-free.  
Therefore, we do not represent that this information is complete or  
accurate and it should not be relied upon as such. All information is  
subject to change without notice.

---

<div class="post-metadata">

**Author:** ![imoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@imoo](https://www.ruby-forum.com/u/imoo)\
**Post date:** [December 10, 2007, 11:25am UTC](https://www.ruby-forum.com/t/new-to-ruby/122644/4 "2007-12-10T11:25:19Z")

</div>

Because gets.chomp.to\_i will never be an empty string (’’).

‘’.to\_i  
–\> 0

nil.to\_i  
–\> 0

Regards,  
Nicolai

---

<div class="post-metadata">

**Author:** ![imoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@imoo](https://www.ruby-forum.com/u/imoo)\
**Post date:** [December 10, 2007, 11:26am UTC](https://www.ruby-forum.com/t/new-to-ruby/122644/5 "2007-12-10T11:26:29Z")

</div>

Hi Imraan,

On Mon, 10 Dec 2007 04:55:51 -0500  
Imraan M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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,

---

<div class="post-metadata">

**Author:** ![imoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@imoo](https://www.ruby-forum.com/u/imoo)\
**Post date:** [December 10, 2007, 11:29am UTC](https://www.ruby-forum.com/t/new-to-ruby/122644/6 "2007-12-10T11:29:13Z")

</div>

Thank you all. I understand now! 🙂

Mark W. wrote:

> Hi Imraan,
> 
> On Mon, 10 Dec 2007 04:55:51 -0500  
> Imraan M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
