If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

AP 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:
ConceptPseudocodeJavaScript
Assignmenta ← expressionvar a = expression;
Equalitya = ba == b
Inequalitya ≠ ba != b
RepetitionREPEAT n TIMESfor (var i = 0; i < n; i++)
RepetitionREPEAT UNTIL (condition)while (condition)
List indexlist[1] is first itemlist[0] is first item
List iterationFOR EACH item IN listfor (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?