I’ve used list comprehension to create an array that builds many rectangles at once.
When made clickable, it mentions that I can use “index” to reference the clicked index in the list.
Does anyone have an example of this in use?
I’m making them change colour individually on clicking so currently I reference each item of the array separately, but I would like to find a more efficient way.
Thank you! I was able to adapt it to create all of my rectangles in a single statement, and change the colour of each when clicked. Here’s my activity in its current form.