Main content
AP®︎/College Computer Science Principles
Course: AP®︎/College Computer Science Principles > Unit 3
Lesson 1: What is programming?Understanding pseudocode
Our programming environment here on Khan Academy uses the JavaScript programming language. There are a large number of programming languages out there, and you may be learning a different language in your AP CSP class.
Thankfully, we have another way to describe programs: pseudocode. Pseudocode is a language that doesn't actually run anywhere, but still represents programming concepts that are common across programming languages. There are different flavors of pseudocode, so here we'll use the one that's used by the AP CSP exam.
This is pseudocode for displaying output:
DISPLAY (expression)
That line of pseudocode means "displays the value of
expression
followed by a space." For example, you might see pseudocode like this:
DISPLAY ("Howdy")
DISPLAY ("Neighbor!")
That represents code that outputs:
"Howdy Neighbor! "
The
DISPLAY (expression)
pseudocode is similar to the println(expression)
that we just learned, but they're slightly different because DISPLAY()
represents code that adds a space while println()
adds a new line.As we go through and learn programming concepts, we'll also show you the pseudocode for each of them, and we'll use the pseudocode in exercises instead of a particular language like JavaScript or Python.
Speaking of exercises: it's practice time!
🙋🏽🙋🏻♀️🙋🏿♂️Do you have any questions about this topic? We'd love to answer— just ask in the questions area below!
Want to join the conversation?
- what does ln in println mean?(8 votes)
- I've actually wondered that myself, I understand the command "print" but what about the "ln" part?(3 votes)
- Isn’t println also used in Java?(5 votes)
- Yes, "println" is used in a number of programming languages.(4 votes)
- How is all this possible because all I have learned so far is how computers store and share binary data, but nothing about how data manipulation happens, which is what programming is.(3 votes)
- Learning the foundation allows you to understand what you're manipulating later on. Manipulating something you don't understand will sooner or later result in all kinds of problems.(8 votes)
- I don't understand what is meant by the line "Pseudocode is a language that doesn't actually run anywhere, but still represents programming concepts"(2 votes)
- Programs written in pseudocode cannot be run on a computer. We write programs in pseudocode so that humans can understand the program without worrying about the syntax of a particular programming language.(4 votes)
- whats the year(2 votes)
- As I write this, it's 2023. You asked that in 2022. Not sure why you want to know the year or what it has to do with pseudocode, but there you go :)(1 vote)
- how do i make games on khan(2 votes)
- The easiest way is with Processing.js! You can learn the basics here (https://www.khanacademy.org/computing/computer-programming/programming), and you can write code here (https://www.khanacademy.org/computer-programming/new/pjs). You then hit "Save", give it a title, and boom! You can also make games with HTML, but that's quite a bit tricker (though more versatile, since it supports stuff like webGL)(1 vote)
- What is the difference between display and println?(1 vote)
- Display is not an actual piece of code. It is pseudocode (code that cannot actually be run but is used to demonstrate a concept). Println (print line) is the code you would run to in place of DISPLAY.(2 votes)
- Has pseudocode changed much over the years (I remember it from Cobol and RPG many years ago). Thanks(0 votes)
- Pseudocode is just what you want the computer to do in more human type language. That description pretty general, so that's why there are many flavors of pseudocode. Other than the standard flavors of pseudocode shifting slightly over time, I don't believe pseudocode has changed.
Hope this answers your question! :)(4 votes)
- what does "println" mean at first I thought it was In but its LN I'm wondering what it means(1 vote)
- The "ln" in "println" stands for "line".(1 vote)
- why do we have to use println anyway.(1 vote)
- You don't have to use println, but it's a good function to know if you're trying to debug a program(1 vote)