# Breaking out of self implemented each

**URL:** <https://www.ruby-forum.com/t/breaking-out-of-self-implemented-each/77746>\
**Category:** Ruby\
**Created:** [March 7, 2006, 10:45am UTC](https://www.ruby-forum.com/t/breaking-out-of-self-implemented-each/77746 "2006-03-07T10:45:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geert\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/d26b3c/32.png) [@Geert\_F](https://www.ruby-forum.com/u/Geert_F)\
**Post date:** [March 7, 2006, 10:45am UTC](https://www.ruby-forum.com/t/breaking-out-of-self-implemented-each/77746/1 "2006-03-07T10:45:15Z")

</div>

Hello,

I implemented a #each method in a C extension and uses rb\_yield for each  
iteration of the #each method. Apparently, the break functionality to  
interupt the normal #each iterations does not work when using my own  
#each function. Why does Ruby not break out of the loop, I return  
control to ruby after each rb\_yield call? How can I catch in my C  
function that a break has been issued, or how can I fix this so that it  
has the required behaviour?

Greetings,

Geert.
