Why “position” value of ListView component always starts from 0?
When we use it for something else or with other components it becomes confusing sometime.
Like if we use it with airtable, I select item from the list and then I use (position) number to update my value in airtable. If I select first item, it’s value according to ListView will be 0 and that will give me error in airtable. If I select second item from ListView, it (ListView) count it as 1, now if I use this number it will update my first value instead of second in airtable.
This means that the index is used as an offset. The first element of the array is exactly contained in the memory location that array refers ( 0 elements away), so it should be denoted as array[ 0 ]. Most programming languages have been designed this way, so indexing from 0 is pretty much inherent to the language .
yes
I am doing that
I am just mentioning here that I figured it out myself but it takes lot of my time. But for some other user (maybe a newbie) this will just confuse him or his app will never work properly.
When you are born, you are born with 0 years. The first birthday is Year 1 Note this does not apply to Korea, were people’s years are counted from 1 and not from 0
Also, if you are not from USA, you will see that elevators/lift count the ground floor as 0, and not as 1, even though it is a floor as well Elevators in USA start counting from 1 from the lowest level
There are plenty of things which start counting at 0, and arrays is one of them
I found one more situation like this, now in same component.
In Tab Layout Component, I choose a specific tab at position 1, but when I use select tab block and join math block “1” it select tab at position 2 instead of 1.
Oh nice
Ok that means when we load something in a list, it loads with “position” which starts from 1
but when we select values from that list, it select values with “array” which starts from 0?
Only for some components like list view image and text but not for all like tab layout.
I think someone should make a guide on position and arrays.
Me???