I'm creating an application that needs to modify the elements of a list.
I've made a test program to investigate the situation.
The "for each element..." loop seems to work well when it comes to using the values of each element. (Button 1)
However, when it comes to modifying the elements of the list itself (initializing them with 0, for example: Button 2), nothing happens... As if it were impossible to modify the elements themselves.
Thank you
So I used the block you suggested in a loop.
It's more complicated, but it works...
In my complete program, I don't have to replace with 0 but I have to use the "Replace all mappings" block. I'll see if I can do it.
Is it normal that using the "for each item" block doesn't work to modify a list itself?
In my complete program, I don't have to replace with 0 but I have to use the "Replace all mappings" block.
This is another test program. The purpose is to spell out the letters of a word or short sentence:
1- Build a list containing the characters of the string.
2- Replace each element by what needs to be read.
Examples :
A --> capital a
? --> question mark
é --> "e" acute accent
...
Replace all mappings" and a dictionary take care of matching.
3- gtts reads the new array: the string is spelled correctly.
However, this other test program doesn't work because it seems impossible for the list elements to be modified by this method.
That's it, I've succeeded in creating a new list.
In fact, if I understand correctly, "item" is a local variable, which is a copy of the corresponding list[i]. "item" is used to retrieve the value of the browsed list, but not to modify it.
Here's my new code, which will enable me to change the values of the items in my list from term to term.