Previous Button

Hello, I am making a City Guide App that shows the visitor several categories, Museums, Restaurants, Parks and so on. Each section having different quantities of items.For instance when a user selects Museums he is presented with eight choices. I am trying to make a previous button that would just take the visitor one step back at a time that is if the user selected the fifth Museum of the list and presses the previous button he is taken back to the section where the eight Museums are shown and not taken back to the main Screen where all categories are. I have managed to get this behavior using if then blocks, though I've noticed that the back button is getting very huge and I've just coded the back button for only one selection of one category. Is there a simpler way to get the desired behavior in a much efficient way? Any help would be greatly appreciated. Here are my blocks:

You could make a list of visited locations, like in this project:


as you visit new locations, add them to the list.
When you are asked to go back, remove the last item from the list and visit the new last item of the list.

Thank you very much I'll look into it :slight_smile:

Hello, I've looked into the example you sent though I could not fully understand it I got the basic idea behind it and I tried to implement it in my code, that is adding visited locations to an empty list and then removing the last item then visiting the new last item. My code is partially working but I can't understand why when clicking on the Second Restaurant Button or the Third or Fourth a second time it shows me the next Restaurant information, i.e. if I click on any Restaurant Button and I go back one step and then click on that same Restaurant Button I get not the corresponding information but the information for the next restaurant, if do this process for the last Button Restaurant then I get the following message:
Attempt to get item number 4 of a list of length 3: ["790.jpg", "casaLammReducida.jpg", "comidaCallejera.jpg"]
Note: You will not see another error reported for 5 seconds.

Any help would be greatly appreciated, here are my blocks

Trying to coordinate multiple lists dynamically is hard.

Try to fully describe each restaurant (name, type, image, ...) in a JSON text object, and stack those JSON text objects in your list.

Hi, thank you for your advice, JSON is new for me but I am digging into the info you sent, I'll post my results :slight_smile:

Hi, I have experimented describing each restaurant in a JSON text object and stack it in my list but I am at a loss, could you please so kind to give me a clue as to how to implement this. I am designing my City Guide app one step at a time and I have been able to solve all previous steps but this one I cannot find a way to solve it. :slight_smile:

You must also learn how to turn a JSON object into a dicionary, and how to look up data in a dictionary.

Thank you, it looks daunting and challenging but I'll experiment with it