Skip to content

Instantly share code, notes, and snippets.

@seungjin
Created May 7, 2009 16:10
Show Gist options
  • Save seungjin/108185 to your computer and use it in GitHub Desktop.
Save seungjin/108185 to your computer and use it in GitHub Desktop.
recursion loop in ecmascript
// get rid of for/while in your ecmascrip!
loop = function(givenF,a,b) {
if ( a >= 0 && b >= a ) { eval(givenF()); a++; loop(givenF,a,b); }
}
sayHello = function() {
print("say hello\n");
}
loop(sayHello,1,4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment