Loops | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

Loops

I know ive asked this question before but i dont think i made myself clear enough. In the code below i have over 10 buttons. Thats a lot of buttons making it look complicated and theres an easer way using create element. so thats easy you just iterate the buttons over 10 times. But what if each button has different text? So one button says “hi” another says “click me” and another is “i eat glue” how would you iterate that is it even possible to iterate that or am i absolutly stupid and is there another way?

29th Dec 2022, 12:32 AM
Junior
Junior - avatar
3 ответов
+ 6
Ofcourse it is posible, check this simple example: If you need adition data,expand each object to have more key:values pairs, now it have just title, it may also have styles, or for example function to run per each btn separately https://code.sololearn.com/Ww42HIHQCQub/?ref=app
29th Dec 2022, 12:57 AM
PanicS
PanicS - avatar
+ 2
heres is the code i used as example: https://code.sololearn.com/W5cqSs3aH5cw/?ref=app
29th Dec 2022, 12:32 AM
Junior
Junior - avatar
0
https://code.sololearn.com/Wwj4gagX6IWH/?ref=app https://code.sololearn.com/W6qp69zwWEza/?ref=app
30th Dec 2022, 3:36 PM
Didi Georgel Danaila
Didi Georgel Danaila - avatar