Dave Thomas wrote:

> Niko Schwarz <niko.schwarz / gmx.net> writes:
> 
>> Hi there,
>> is there a way to exit a block before time?
>> like:
>> 
>> field.each { |el|
>>         if(el.alsacian?)
>>                 break #no, dont want anymore
>>         else
>>                 puts el
>>         end
>> }
> 
> Doesn't 'break' work?

Unfortunately not, i tried this:

,----[ eval.rb ]
| ruby> 1.upto(5) { |i|
| ruby| if i.divmod(2) == 0 then
| ruby| break
| ruby| end
| ruby| puts i
| ruby| }
| 1
| 2
| 3
| 4
| 5
| 1
`------ 

The break doesnt seem to do anything, whats happening here?

regards,

nick
-- 
QUOTE OF THE DAY:

       `