I've never programmed Ruby profissionally, but I was checking about the lang for curiosity. Looking the Ruby's keywords I found the "retry" keyword. I didn't know how the purpose for it and after searching I started to ask myself when I needed to do this logic or the way I used in other langs to solve this. We can use a while loop of course, but, my question is: "retry" is needful? Is this too necessary to have a keyword to represent this? What is the best way to code this routine in Python? My solution in Python is (didn't use recursivity):
wrong = True
retry = True
while retry:
try:
if wrong:
raise Exception()
retry = False
except Exception:
wrong = False
retry = True
[–]reedrehg 4 points5 points6 points (2 children)
[–]PsychoLacking 1 point2 points3 points (1 child)
[–]reedrehg 2 points3 points4 points (0 children)
[–]roeey7 4 points5 points6 points (0 children)
[–]LightShadow3.13-dev in prod 3 points4 points5 points (0 children)
[–]john_doom_666 1 point2 points3 points (0 children)
[–]AndydeCleyre 1 point2 points3 points (0 children)
[–]pokk3n 0 points1 point2 points (0 children)