Skip to content

Instantly share code, notes, and snippets.

@davidnunez
Created June 23, 2011 19:02
Show Gist options
  • Save davidnunez/1043316 to your computer and use it in GitHub Desktop.
Save davidnunez/1043316 to your computer and use it in GitHub Desktop.
Optimized Eyeball Clock Array init
// initializes your array
$newcolori = array();
// - for loop will repeat everything inside the '{...}' a certain number of times
// - i starts at 0 ('i=0')
// - i increases by 1 every time the loop repeats 'i++'
// - the for loop will repeat as long as i is less than or equal to 60 (starts at 0 goes up to 59) 'i<=60'
for (i=0;i<=60;i++)
{
// - i is just like any other variable here... it just changes on every loop
// - you can create strings by combining a string and a variable "msgray"+i
$newcolori[i] = new Oval(200, "msgray"+i, 45,45,345,345);
}
@davidnunez
Copy link
Author

This gist was for my friend emily to show her how to do for loops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment