Created
December 10, 2015 03:32
-
-
Save relsqui/95d24b02aae58144b023 to your computer and use it in GitHub Desktop.
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
> iter = Utils::iterate((string[]) {"foo", "bar", "baz"}); | |
> string a; | |
> while (iter(&a)) { | |
+ printf("%s\n", a); | |
+ } | |
foo | |
bar | |
baz |
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
namespace Utils { | |
public bool(*poly) function iterate(poly[] list) { | |
return (bool func(*poly value) { | |
static int i = 0; | |
if (i < dim(list)) { | |
*value = list[i]; | |
i++; | |
return true; | |
} else { | |
return false; | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment