# Loop skip to next entry

**URL:** <https://www.ruby-forum.com/t/loop-skip-to-next-entry/128993>\
**Category:** Rails\
**Created:** [February 13, 2008, 11:10am UTC](https://www.ruby-forum.com/t/loop-skip-to-next-entry/128993 "2008-02-13T11:10:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KTU](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecae2f/32.png) [@KTU](https://www.ruby-forum.com/u/KTU)\
**Post date:** [February 13, 2008, 11:10am UTC](https://www.ruby-forum.com/t/loop-skip-to-next-entry/128993/1 "2008-02-13T11:10:47Z")

</div>

whats the syntax for next item jump on the loop

\<% @ldap\_entries.each do |entry| %\>  
\<% if entry[:mail] == ‘’ %\>  
\<% next %\>

does not seem to work ?

---

<div class="post-metadata">

**Author:** ![KTU](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecae2f/32.png) [@KTU](https://www.ruby-forum.com/u/KTU)\
**Post date:** [February 13, 2008, 11:30am UTC](https://www.ruby-forum.com/t/loop-skip-to-next-entry/128993/2 "2008-02-13T11:30:22Z")

</div>

KTU wrote:

> whats the syntax for next item jump on the loop
> 
> \<% @ldap\_entries.each do |entry| %\>  
> \<% if entry[:mail] == ‘’ %\>  
> \<% next %\>
> 
> does not seem to work ?

Hi KTU,

Not exactly sure what you want to do here, but if you are looking to  
“filter”  
your ldap\_entries array you might want to use the “select” interator.

@ldap\_entries.select{|e| entry[:mail] != ‘’}.each

Cheers,  
Aditya
