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
Get started with pseudocode. Learn some basic conventions for describing a program with input, output, and variables.
Examples
Simple sequence
prompt user for number
set num1 to user_input
prompt user for number
set num2 to user_input
set sum to num1 + num2
print sum
Using a conditional statement
prompt user for number
if input is not a number
print "input is not a number"
prompt user for new number
endif
set num1 to user_input
prompt user for number
if input is not a number
print "input is not a number"
prompt user for new number
endif
set num2 to user_input
set sum to num1 + num2
print sum
Multiple conditions
if input is not a number
print "this is not a number"
else if input is odd
print "the number is odd"
else the input is even
print "the number is even"
endif
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
When you write pseudo code,
you explain each step in the program.
0:00
Think of it kinda like a recipe.
0:00
A program usually has some data,
or ingredients,
0:01
that are acted upon just like you peel,
mix, whisk, eat and bake while cooking.
0:03
A recipe lists the exact order
in which to perform each step.
0:09
If you bake, for
0:12
example, before you mix the batter,
your cake won't turn out right.
0:13
You can write pseudo code on paper with
a pen, or open up a text editor and
0:17
use code comments to describe your
program's logic in pseudo code.
0:21
Let me walk you through an example.
0:25
For any programming project, we usually
start with a set of requirements.
0:27
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