Problem in loop do

Hi
please explain me with example in “loop do” , diffrence between “redo”
and “next”.
tnx

On 28.07.2010 13:10, Amir E. wrote:

please explain me with example in “loop do” , diffrence between “redo”
and “next”.

Why don’t you just write a small program and test it out for yourself?

Cheers

robert

Robert K. wrote:

On 28.07.2010 13:10, Amir E. wrote:

please explain me with example in “loop do” , diffrence between “redo”
and “next”.

Why don’t you just write a small program and test it out for yourself?

Cheers

robert

I wrote a small program , and I test for myself but the result for
“next” and “redo” was same.
now please help me .

Amir E. wrote:

I wrote a small program , and I test for myself but the result for
“next” and “redo” was same.
now please help me .

I’ve not been visiting here for very long, but I suspect people will be
quicker/more inclined to help if you provide the program you’ve created
to test the issue/question.

Play with the following code – run it and see what it does… uncomment
the “next if i < 3” line, run it, and see what it does… recomment the
“next” line, uncomment the “redo” line, run it, and see what it does.

for i in 1…5
puts 'current value of i is: ’ + i.to_s
#next if i < 3;
#redo if i < 3;
puts 'end of loop and i is: ’ + i.to_s
end

Additionally, a quick Google search of “ruby redo next” will turn up
this link: