Skip to content

Instantly share code, notes, and snippets.

@tomauty
Created January 21, 2015 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomauty/c9cb43a538e781d988f7 to your computer and use it in GitHub Desktop.
Save tomauty/c9cb43a538e781d988f7 to your computer and use it in GitHub Desktop.
pseudocode for multi-object spawning
// Say a constructed object takes three arguments and you dont need to reference them after they're constructed
args = [
[ 7, 10, true ]
[ 9, 1, true ]
[ 4, 6, true ]
[ 1, 9, false ]
]
for (i in args) {
// Variables created under here will not be usable outside of the array, so you can't manipulate them once
// they're instantiated. But this way you only have one section to modify the arguments.
createNewObject(args[i][0], args[i][1], args[i][2]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment