Created
September 20, 2016 21:55
-
-
Save slambert/75ee8fc14e5b613c283e582ba8f830c9 to your computer and use it in GitHub Desktop.
for vs while with same result
This file contains hidden or 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
//Steve Lambert September 20, 2016 | |
//for and while loop demo v1 | |
void setup() { | |
size(500,500); | |
smooth(); | |
} // end setup | |
void draw() { | |
background(255); | |
// This is a while loop | |
//start with i as 0 | |
int i = 0; | |
//while i is less than the width of the window | |
while(i < width ){ | |
line(i,20,i,200); | |
//i++; | |
i = i + 10; | |
} | |
// This is a for loop | |
for(i = 0; i < width; i += 10){ | |
line(i,250,i,450); | |
} // end for loop | |
} // end draw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment