# Re: Is this a bug or a feature?

**URL:** <https://www.ruby-forum.com/t/re-is-this-a-bug-or-a-feature/113983>\
**Category:** Ruby\
**Created:** [September 6, 2007, 9:16pm UTC](https://www.ruby-forum.com/t/re-is-this-a-bug-or-a-feature/113983 "2007-09-06T21:16:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [September 6, 2007, 9:16pm UTC](https://www.ruby-forum.com/t/re-is-this-a-bug-or-a-feature/113983/1 "2007-09-06T21:16:04Z")

</div>

That’s the behavior I would expect it to have. Why wouldn’t you do:

irb(main):001:0\> i = 1  
=\> 1  
irb(main):002:0\> until i \> 5  
irb(main):003:1\> p i  
irb(main):004:1\> i += 1  
irb(main):005:1\> end  
1  
2  
3  
4  
5

instead?

----- Original Message ----  
From: Martin J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: ruby-talk ML [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Thursday, September 6, 2007 1:00:28 PM  
Subject: Is this a bug or a feature?

irb(main):002:0\> i=1  
=\> 1  
irb(main):003:0\> until (i+=1)\>5  
irb(main):004:1\> p i  
irb(main):005:1\> end  
2  
3  
4  
5  
=\> nil  
irb(main):006:0\> RUBY\_VERSION  
=\> “1.8.3”

The condition is evaluated before the first iteration.

At least it’s consistent:

irb(main):005:0\> i = 1  
=\> 1  
irb(main):006:0\> p i until (i+=1)\>5  
2  
3  
4  
5  
=\> nil

## I think it makes “until” less useful. Why would anyone want this?

Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

```
  ____________________________________________________________________________________

```

Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user  
panel and lay it on us.  
[http://surveylink.yahoo.com/gmrs/yahoo\_panel\_invite.asp?a=7](http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7)
