Java-Script of course does not have a Repeat Until command (as far as I know) but the AP test uses Pseudocode that includes a Repeat Until Command. My experience has been that the statements of a Repeat Until Loop are executed at least once and the condition is checked at the bottom of the loop to determine if the loop statements are “repeated”. I can not tell from the College Board Pseudocode documentation if this is how their theoretical Repeat Until Command would execute. Any Thoughts? Who could I ask for clarification?
Looking at how the pseudocode is structured, I would think that the condition is checked before the statements inside the loop are excuted. So if the initial condition is true, the loop will not execute. I searched through some questions in AP Classroom and the questions titled “Correcting errors in procedure Multiply” and “Error with multiplication using repeated addition” demonstrate this.
Could you post a like to that. The College Board Site is one of the worse sites ever to navigate and find things.
This is a problem in that there is no universal standard for how to write the syntax of pseudocode. The meaning is left solely up to the person writing it. Most programming languages have FOR loops, WHILE loops, and DO-WHILE loops. The difference between a WHILE and DO-WHILE is whether the exit condition is checked at the top of the loop or at the bottom of the loop. That is, a DO-WHILE loop is guaranteed to perform the loop body at least once, whereas a WHILE loop may never execute that body at all depending on the conditions. Note: Programming languages like the popular PYTHON does not have explicit syntax for a DO-WHILE loop. AP CSP is supposed to be programming language agnostic, but there are lots of subtle differences among the over 9,000 documented computer programming languages.
For AP CSP pseudo-code, I would say their invention of “REPEAT n TIMES” is their crude way of doing a FOR loop, which is a type of loop where we usually have a known loop counter. Their “REPEAT UNTIL (condition)” is their equivalent of “WHILE (condition)” which is evaluated at the top before beginning the body and the number of times the body loops is not set in stone. This is the typical case for WHILE loops.
And it is a fallacy that all FOR loops can be rewritten using a standard template to become a WHILE loop, but that is another discussion.
Since the questions are secure, I can’t post the link here. But if you go to All Questions in the Question Bank in AP Classroom and type the titles I provided, you should find the exact questions.
I agree with your statement about pseudocode. That being said, a person can be good at actual coding and poor at answering the AP Test questions about pseudocode. In writing actual program code, the programmer has access to an actual computer to try out the code and the the program can be debugged if it does not work as intended. While taking the AP test, the student’s brain has to simulate being the computer.
As stressed to students when completing coding projects, it’s okay to make mistakes. When taking the AP Test… not so much.