Does my code have selection, sequencing and iteration for the AP CSP Exam? I know I don't have iteration yet

Do I have to use a for each item in list or a for each number as an iteration, or could I implement a loop or iteration without control blocks.
Thank you,
AP CSP Student.

Regards selection, sequencing and iteration App Inventor examples:

I know what they are. My main question is if I have to use the control blocks for iteration because I saw another post in this community not use a control blocks for their iteration/loop.

Did you view the video? If you did then you have sufficient information to decide.

There are many ways to iterate and or loop. If they did it with a control block and it works good for them.

1 Like

Won't it be easier if you just tell me as it's more specific to my code and makes more sense for some to type?

What? I just need to quickly make sure I have all the information I need so I can quickly update my AP EXAM portfolio which is due 2 days from now. I have to deal with studying for 4 other AP's and this one while juggling musical events such as NEMFA which occurred when we first started this project, and jazz band, wind ensemble, etc... Not to be rude, but I don't have time for this. You are effectively wasting my time by making me watch a general video rather than specific tips. Idek what to do anymore, I'm stressed out because of 4 other AP's far more important and school events, idek why I took CSP instead of AP Psychology.


If you want to ensure your Procedure does an iteration perhaps add a while test do block or a for each item in list do block; if you use either it guarantees you have done an iteration.

this may help

1 Like

Sorry for yapping. But I've never utilized the while test block. Would I use a true or false value because it just stopped the calculate procedure from working for the app.
Thank you,
CSP student
Screenshot 2024-04-28 6.14.51 PM

while test is true, it will execute; if false then it will stop executing.

See the link posted earlier Figure 20-6. for an example of it's usage.

should I add a true then. my calculate procedure didn't work when I tried.

a while loop does ot make sense in this case, remove it completely

use Do it to debug your blocks

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.



Would your instructor accept inserting a Logic true block in while test?

The instructor would be college board in this case, so I don't know.

what does the green arrow indicate on the set label3. text as I don't understand your interpretation there.

move the blocks from where they are to between the purple and yellow if block.

You might also test with both true and false Logic blocks. However you really should be doing something like in figure 20.6 which means use while test do with a List.

It didn't work. It made it so that my code doesn't work.

Could the screenshot of the code count as iteration in itself?

Would this work for college board as I need an iteration inside my procedure.
Screenshot 2024-04-28 8.45.31 PM

Sorry, I do not understand your question.

Does your Procedure calculate calories for males and females when you use the for each number Block (the one you posted Taifun)? The counter will actually add no functionality to the Procedure but it technically provides an iteration within the Procedure.

I do not know about these exams, because I live in a part of the world where they do not exist. I do know however, that I would give you two F's. One for not understanding or even trying to understand the problem and another for being rude at people who are trying to help you, who all are volunteers. And, they cannot help it that you started too late.

Now, you are showing only a very small part of your blocks, but looking at these I assume that maleCalorieWeight and femaleCalorieWeight are very similar.
You coud combine these into one procedure, with an extra parameter, male or female (can people be both male and female in your app?). Then, put the checkboxes in a list and iterate over this list using the "for each item in list" control block to call the procedure with the right parameters. This is just one way you could use lists and iterations.