For loop problem
in
Programming Questions
•
9 months ago
I'm trying to draw a counter, but i have a problem with the for loop.... Why all the values are displayed when the loop is over??
Please help
- void setup(){
- size(400,400);
- fill(0);
- }
- void draw(){
- for (int i=0; i<=20; i++){
- textSize(20);
- text("Counter:" + i , 100,100);
- println(i);
- delay(1000);
- fill(0);
- }
- }
- //Delay
- void delay (int ms){
- int time = millis();
- while(millis()-time < ms);
- }
1