From: Amir Ebrahimifard on
Hi
please explain me with example in "loop do" , diffrence between "redo"
and "next".
tnx
--
Posted via http://www.ruby-forum.com/.

From: Robert Klemme on
On 28.07.2010 13:10, Amir Ebrahimifard 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


--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
From: Amir Ebrahimifard on
Robert Klemme wrote:
> On 28.07.2010 13:10, Amir Ebrahimifard 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 .
--
Posted via http://www.ruby-forum.com/.

From: Bob Smith on
Amir Ebrahimifard 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:

http://www.tutorialspoint.com/ruby/ruby_loops.htm
--
Posted via http://www.ruby-forum.com/.