Main content
AP®︎/College Computer Science Principles
Course: AP®︎/College Computer Science Principles > Unit 9
Lesson 2: Learn AP CSP exam pseudocodeAP CSP pseudocode vs. JavaScript
Since AP CS Principles is taught with a variety of programming languages, the AP CSP exam questions use a pseudocode that represents fundamental programming concepts.
You can see the full pseudocode reference online here or on page 205 of the College Board AP CSP exam description.
There are many differences between the AP CSP pseudocode and the JavaScript language syntax.
This table highlights the biggest differences:
Concept | Pseudocode | JavaScript |
---|---|---|
Assignment | a ← expression | var a = expression; |
Equality | a = b | a == b |
Inequality | a ≠ b | a != b |
Repetition | REPEAT n TIMES | for (var i = 0; i < n; i++) |
Repetition | REPEAT UNTIL (condition) | while (condition) |
List index | list[1] is first item | list[0] is first item |
List iteration | FOR EACH item IN list | for (var i = 0; i < list.length; i++) |
To make sure you understand the pseudocode, practice using it in the exercises from our Programming and Algorithms units.
Want to join the conversation?
- when will there be a full moon?(6 votes)
- Friday, May 5,pm CST 12:34(5 votes)
- Shouldn't Repetition be while (!condition) in JS(4 votes)
- A
while
loop is run while the provided condition is true. However, if your condition describes the criteria for ending thewhile
loop, thenwhile (!condition)
would be fitting, like you say.(5 votes)
- I like mc donalds(2 votes)