E
Emil Sandin
Hi, is there an easy way to redefine 'while'. I have a class that uses a
while loop. In my unit test it always evaluates to false (which is
correct). I only want the loop to run once, and the enter. Just like an
if.
This is the code I've tried:
def while(condition)
p "redefined while!"
yield if condition
end
while true do
p "hello"
sleep 1
end
But it loops eternally.
Any help?
while loop. In my unit test it always evaluates to false (which is
correct). I only want the loop to run once, and the enter. Just like an
if.
This is the code I've tried:
def while(condition)
p "redefined while!"
yield if condition
end
while true do
p "hello"
sleep 1
end
But it loops eternally.
Any help?