Created
May 29, 2015 16:05
-
-
Save mattcanty/0437fad1999fd39d95f6 to your computer and use it in GitHub Desktop.
F# Retry Loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec retry times fn = | |
if times > 1 then | |
try | |
fn() | |
with | |
| _ -> retry (times - 1) fn | |
else | |
fn() | |
//Source @gradbot on Stack Overflow http://stackoverflow.com/a/5942170/966609 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment