Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Plan Ahead with Pseudocode!
You have completed Plan Ahead with Pseudocode!
Preview
Learn what pseudocode is and how it can help you become a better programmer by planning ahead and thinking about the logic of your program before writing any code.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Hi, I'm Reggie Williams.
0:09
I hope you've enjoyed your learning so far
and are prepared to continue your journey.
0:10
In this workshop, I'll teach you how
to write something called pseudocode.
0:14
Pseudocode will help you plan your
projects ahead, communicate your ideas to
0:17
teammates, and help you identify logical
errors before you write any code.
0:20
Programs contain both logic and syntax.
0:25
Logic is the order in which the program
runs, the decisions made within
0:28
the program, and how you structure
the different parts of the program.
0:31
Syntax is the actual programming language,
the very specific set of words and
0:35
symbols you write to
make the program work.
0:39
Each language has its own specific syntax.
0:42
So to create a variable in JavaScript,
you write something like this.
0:45
But in C#, it would look like this.
0:48
Both lines of code do the same thing,
0:50
store the value zero into
a variable named score.
0:52
The syntax is different, but
the logic is the same in both cases.
0:55
Thinking through the logic of a program
is often the biggest challenge in
0:59
creating a program.
1:02
And fortunately, using pseudocode,
1:03
you can easily lay out your
program's logic before coding.
1:05
Pseudocode is a notation that resembles
plain speech to describe the logic of
1:09
your program.
1:12
Here's an example of pseudocode that
describes a college admissions program.
1:13
You can see it reads very much like
English, no programming syntax required.
1:17
For example, some lines start with
verbs like set, input, and output.
1:21
These might be the actions or
functions in the program.
1:25
Questions that may lead
to different paths or
1:29
conditions begin with words like else or
if.
1:32
Keep in mind that pseudocode is meant for
humans, not computers.
1:35
It's not real code and
won't run on a computer.
1:39
But it does help you describe
how the program will run.
1:41
Pseudocode can also be used as
comments to document your code.
1:44
One of my favorite practices is writing
pseudocode in the text editor as comments
1:48
and then writing my code
directly under each line.
1:51
In the next video, I'll teach you some
of the basics of writing pseudocode.
1:55
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up