Save different returns for looped function

Hi all
So I have a function that creates multiple sliders. The function is then looped to create multiple sliders. I want the slider values to be stored in an array, for each slider a single array element. How would I have to do that without making a variable for every single slider?

https://editor.p5js.org/RBvonRB/sketches/zMBKdiAVm

Thanks for any help!

1 Like

best is to make the sliders as a array, not the slider.value only?

https://editor.p5js.org/kll/sketches/rRjOfo2nI

this shows a possible function,
as the words are inherent good or bad,
the color (red … green) i tried is worthless
it’s just to show coding possibilities ( slider feedback )

3 Likes

Thanks for your suggestion, I should have specified my question. The sliders are only the first step in the process. After setting the sliders, you can proceed to the next page, where a picture is calculated based on your answers. For that picture, I need all the slider values stored and separately accessible.

1 Like

In Kll’s code the values of each slider is properly displayed on the canvas. Your next step could be to figure out how (and when) those values get stored as well. Will you save those values constantly in an array? Will the values be stored once the user pressed the ‘next’ button?

Hope this helps! :slight_smile:

2 Likes

rev: check my example again please.

That’s what I was looking for, thanks to both of you