So I was working on the quiz solution, and
I had some code like this:
b = simulate board,m
while another_turn?(b,m)
b = simulate b,m
end
If I was doing this in C, I'd use a do-while loop instead, to avoid
repeating the line outside the loop:
b = board;
do {
b = simulate(b.m);
}
while ( another_turnta(b,m));
What's the do-while idiom in ruby?
I ended up with this, but it needs an extra flag variable:
b,taketurn = board,true
while taketurn
b = simulate b,m
taketurn = another_turn?(b,m)
end
Is there a ruby idiom for do-while?
-Adam