A FOR-LOOP is a method to have repetition in a sketch. It is a shorter way of writing a WHILE command. In this sketch I used for-loop and then added an IF/ELSE boolean to it.
The basic draw is a Battery. The lines within it are made with a for-loop. The little green button is using a mousePress command which applies the if command. “if mouse press within the button area, then the battery will charge”.