I'm new (fairly) to AI2 programming. I'm using blocks that repeat 12 times (several blocks). There is a system for making loops to update them without having to name each one individually as can be done in other languages. By adding a counter to the base of the object name.
Depends what you want to do in this loop 12 times? If a quick calculation that doesn't need to be exposed in the UI then use this:
I'm 77 and worked in IT 40 year most of time programming . So in other language if i need to update several object i write:
for x from 1 to 12
part of object name & x = "blabla"
In AI2 i need to do:
Anoing ripetition and time consuming
By objects, do you mean components? Or variables? Maybe show blocks where you have to repeat the code. In AppInventor, you can't operate on component names, e.g. "label" + "1"... here we use lists. You can add all objects to the list, then by iterating through the list you can modify the values assigned to the object.
Can you please send me an example on how use lists? thank you
In this case, it might look like this:
Because your object is text and it has a number in it.
If there were no numbers in the text, you would have to create a list and iterate through the list:
NO sorry, the problem is not in the text DNF but in the components like LabDATANASC1, LabDATANASC2,LabDATANASC3 and so on. The same for the SWITCHES.
I must repeat then for 12 times, and also in other code.
Please send me an example on how use the lists. Thank you.
Ah, I see now that there are different component names.
For example, if you don't have more components of the same type in the app than in the list, you can use a block to replace the list:
Well, I start understanding a little. I need to practice with lists in this use. You been very usefull to me and I TY so much.
I'm back again. Where can I find the command 'Label.Text of component' and the other TextBox.Text of component?
You can also right-click on the block and select "Make Generic" from the menu.
OOOOKK...I never look at it. Again TY
Here's a sample for you to study ...