The quiz works great however when I reach the end it just stays at the last question. It does not return to the home page or loop to the beginning. I have followed several tutorials however many are several years old and the blocks are slightly different so I think I missed something. I am new so please be as detailed as possible on steps needed to fix this, or show a screenshot would be best. Thank you.
What you have in theory should work. So What I would do to debug this, is have both the value of index and question list display on the screen, that way you can see if they are updating correctly.
Thank you @shrey for the fix and @zander for pointing me to the final issue…
Yes @zander you was correct that it should be working. It worked flawless… I just had another error and your test idea pointed me to it… I forgot the “Set app variable questionlist to 1 block” at screen start. So it had nothing to compare the index to.
I was making cosmetic changes (button backgrounds and shadows) and tested it again and its no longer going to home screen after end of quiz. I have gone over all the code and I cannot see the issue. Here are current screenshots of the blocks and the link to the project. I am racking my brain trying to figure out why its no longer working. I added a test message to the header to keep track of the Index and QuestionList numbers and they update accordingly.
Ok I changed the 1st and 2nd things you said and it now goes to home screen after the 1st question is answered. As for the 3rd thing you mentioned I am not exactly sure what your asking me to do. Please clarify. Thanks.
OK I changed that and now it only shows the 3rd question, however it shows it 3 times then continues to the home screen as it should.
My other issue will be if I set that to the number of questions then I have to make edits to the blocks any time I want to add or remove questions to the database. This is not ideal. I think that is why the tutorial I followed put the “length of” block in the IF statement.
The project will halt and will not move to next block if you try to force a type casting.
The app variable QuestionList is initialized as an integer (a number) and then within the codes you use Length of block which is used specifically for lists and not numbers.
Replace this block with another more appropriate block. For instance, check if the variable equals to zero or greater than a number but avoid getting the length of that variable.
See the comment just above yours. I think we addressed that issue and have moved on to the issue of staying at the last question. I cannot get it to move on to the home page after last question. I am new so I’m still learning. Im not sure how to check if variable equals zero or greater.