Alright, so apparently boolean flags are a no-go. Oops.
The other thing that pops to mind is catching an error, but you said you don't want to do that, or wrap it in a method and return. Honestly, there doesn't seem to be a way, but here's the simplest I could come up with:
catch (:exit) do
while true
while true
throw :exit if condition
end
end
end
You could also throw an exception, but that seems dirty. Here's the code to do it, though:
begin
while true
while true
raise "Exiting loops" if condition
end
end
rescue
#Code to go after the loop
end
Lastly, you could wrap the whole thing in a method and return from that method:
def my_descriptive_method_name()
while true
while true
return if condition
end
end
end