xxxxxxxxxx
31
myArray = []
function setup() {
createCanvas(400, 400);
//Setup array of random numbers
for(i = 0; i < 20; i++){
myArray.push(random(1,10));
}
}
function draw() {
background(220);
deleteBox();
//Display the array
for(i = 0; i < myArray.length; i++){
text("Item " + i + ": " + myArray[i], 50, i*20);
}
}
function mousePressed(){
// Remove the first element of the array
myArray.splice(0,1);
}
function deleteBox(){
ellipse(50,50,50,50);
}