Hi All,
I can’t quite work out if this thread is about the same problem i am finding.
Basically i am trying to add items to an empty list and then return the index of where that item is positioned. I used these blocks but the label i was hoping to display the position of ‘T’ comes out as 0. Which i understand means not found.
Second set of blocks shows how I previously had success with this in MIT app inventor. I’m new to thunkable and wondering if ive used the wrong blocks.
Appreciate any help
Thanks,
James
Hey @jamesshepherd876pnr
Don’t think this is related to the previous topic so I’ve moved it here to make it easier to find.
Here’s a quick summary of what’s happening, and the solution is at the end.
I’m guessing this is how the error happened. You had these blocks:
The find in list
block creates its own local list to search through. We can consider this to be:
list(a,b)
You’ve also created your own global list, lets call it:
myList()
So, when you click on the button you pass your global list into the local list. Essentially:
list(myList(T))
So your list is actually inside of another list.
To get this working, all you need to do is pass myList()
as the input for the list parameter, like this:
2 Likes
@domhnallohanlon
This is great thanks so much! Saved me a lot of brain ache.
For anyone else looking and trying to do the same. I had a bit of trouble getting this block into the same format you mentioned (probably a rookie mistake)
But I was looking at this and thinking it was the same as yours:
I realised I had to remove all ‘items’ from the list, otherwise like you mentioned I’m putting a list in a list:
And then it came up as empty list:
And then add the list variable
Might have just taught anyone watching to suck eggs but in case a newbie like me was out there scratching their head well there you are!
2 Likes