Getting rid of "undefined" at the end of the list

Hello,
I’m a teacher making “flashcards” as an app. My kids go through a list of words and when it gets to the end the screen says “undefined.” I’d rather have it just end and say nothing, or somehow add a message like “You’re done!” How do I do which everone is easier?! (Please show with pictures, I don’t speak engineer.) Thanks

1 Like

Can you show your blocks please?

43%20PM

12%20PM
The top is just my list…

@Laura_Griffith May I ask what are NoButton and YesButton made for ? In one you delete and the other one you shuffle. Thanks

You may want to do this image It checks if there is only one item remaining and displays this item (your message)

EDIT : If you don’t want to code a hard thing to avoid showing this message while shuffling blabla use this instead image

1 Like

Thanks, I will try it when I get a chance…not on my computer. The reason is when a child gets the right answer, an adult presses “yes” and the word goes off the list. If a child gets a wrong answer it is shuffled back in the list so they can practice it again. But eventually, when a child gets them all right it runs out of things on the list.

I’m wondering if the first one will work because I have it on shuffle, so the last item remaining may not be my message. Also, I was not able to do either of those because some of those blocks don’t even exist as choices for me.

52%20AM

There is no control I can add other than what i have that highlights orange and is usable. there is no function choice like your “set label or button text”

your screen shots look like these blocks connected to another function that i don’t have??

Hi Laura, could you share your project? It’ll be easier for us to show you how the the solution works. Thanks @AcrobatEpee for your solution to this.

My screenshots were just there to make you understand. The block you need is not in the procedure part. You need to understand that we are here to help you understand, not to give you answers to copy paste. The blocks you need in that part are indeed not procedure blocks. You want to display a message on your label when it’s done. The block you need is already available in the screenshot you sent. Look at it and you’ll find it

That’s why I gave the second in the EDIT part which is basically just adding an if block (and an else block together with that if for your normal blocks to happen if you’re not over with the list (so if the length is not equal to 0)

I added the if statement from @AcrobatEpee 's solution to your project here:
https://x.thunkable.com/copy/8e955aaa488cfb2874afe5454744e2e3

In the project linked below, in addition to adding the if statement, I moved all of your words into a local db. Click the localdb component, then click the link on the right that says “Click to edit data table” to see your words.
https://x.thunkable.com/copy/8ec8f83dd85e436d2a13df92568d6843

1 Like

Yeah! Thanks for your help…we’re so close! After it shows the final message it still says undefined when you tap the “no” button. If I tap yes again, it returns to the end message, but then undefined when you tap no. Anyway to get rid of the undefined? Or have it say my end message no matter what someone taps on at the end?

Nevermind, I figured it out! :slight_smile: Thanks for all your help!

Nope, spoke to soon. Got rid of the undefined, but another problem came up. Now the shuffled isn’t working like it did before the changes. When the no button is pushed, the word from the list should be reshuffled back into the list again. Now it disappears just as if you hit the yes button.

Back the original problem…Still says undefined on the app when I get to the end of the list. The end message does show up after all the words have been practice, but then if someone taps the no button it still says “undefined.”