Any way to advance to an iterator prematurely?

K

Kurt Euler

All-

In the code below, is there an way to put a condition just before <do a big bunch of stuff?> that will cause the iterator to advance to the next x (the next line in control.txt) WITHOUT doing <do a big bunch of stuff>. I thinking something like "if field[0] != "test" read_next_line_in_file". I'd
rather not put <do a big bunch of stuff> in a giant if/end statement.



IO.foreach("control.txt") { |x|
field = x.chop.split('\t', -1)
<do a big bunch of stuff?>
}



Thanks!

-Kurt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top