Main content
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?(11 votes)
- The "ln" in "println();" is "line".(9 votes)
- Why do we use printin?(3 votes)
- (with an L) println allows us to display text in the console (this is what the user sees)(2 votes)
- Why is this programing so important? And why do we have to know about this?(3 votes)
- Programming is important because it is basically the core of computer science. Software Engineers (computer programmers) write the software that we run on devices. This act is called programming.(9 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.(2 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.(9 votes)
- Isn’t println also used in Java?(4 votes)
- Yes, "println" is used in a number of programming languages.(4 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.(5 votes)
- Why can't you just use the display for both words and add a space in-between?(4 votes)
- what does ; mean(1 vote)
- In many languages (C#, C++, C, JS, Java etc.) semicolon is used to divide discrete commands. It is similar to "." in human languages.
There are languages that don't use semicolon. The simplest example is Python, where on each line there is another command.
Also there are "hybrids". Languages that can use semicolons to divide commands, but they don't always need it. As example I can name PowerShell.
Scripts can be written there without semicolons. F.e.:
$date = (Get-Date).AddDays(-1)
Write-Host $date
I can use semicolons as well:
$date = (Get-Date).AddDays(-1); Write-Host $date
And it will work the same. Exactly the same. As you can see in PowerShell we can divide commands by breaking a lane (pressing Enter button) or by using semicolon.(5 votes)
- NO I dont have a question.(2 votes)
- why do we use pseudocode(2 votes)