Easier way to write if else statement

Hello,

Welcome to the Processing forum.

This is my first pass at this:

int [] x = {100, 200, 300};
int [] y = {300, 200, 100};

int lives = 3;
 
 for (int i = 0; i < lives; i++)
    {
    xl = x[i];
    yl = y[i];
    image(image1, xl, yl);
    }

(xl, yl) can be anything you want; I put data into an array for testing only.

Update: I did not realize I was answering this so late; I do not always look at other posts as this influences my “first pass” coding efforts. I will leave it…

2 Likes