This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Learn any language in 7 easy payments....


Okay, enough background. Let's jump in.

What you are about to learn is largely true with all computer languages. I'm using Python to demonstrate, but you could use this info in Java or C++ or anything with a little amount of translation.

First of all: Text editors. You gotta get one.
In this course, we’ll mostly play with codecademy's online IDE (Integrated Development Environment) because doing stuff like this online is just way cool. If you want to play with it outside of this exercise try:
http://labs.codecademy.com/#:workspace
If you’d like to, you can install python to your personal computer. There are many great resources on the internet that will help you to do this. But you will still need to have a good text editor.  On windows I use Notepad++, on Mac I like Jedit, and on *nix “vi” is still the best. These are my opinions. You can’t use Notepad, Word or Wordpad. The point is to write text, not configure weird programs that think they are advanced into doing their basic job, which they don’t want to do anyway.
I mean, it's text! How hard can it be! (I'm looking at you, Microsoft...)
The point is that there is a process to writing code. You don't just sit down and start cranking it out. Get used to writing in "pseudocode". There's a secret to this I'll let you in on later, but for now trust me that it's a very important habit to get into.
Here's a sample for a little store program:
Start
input itemPrice "Please input the price:"
totalPurchase = itemPrice * salesTax
output "Your purchase today is ", totalPurchase
Stop
But the point is to write the steps of your program out in normal human language. I will admit that my normal human language might be closer to programming languages than most, sorry.
Notice that there are three variables above:
itemPrice
salesTax
totalPurchase

Knowing what a variable is, is very important. More important than you think as we go along. When we start passing them between different sets of code, it will be very easy to screw up if you don't have it down.
A variable is a known, named place in the computer's memory. It's a space a specific size, at a certain address in the memory. The 'value' of the variable is simply whatever information is being stored there. It could be a number or text or whatever. There are things called 'types' that are important because it tells the computer what kind of information is there, and also how big to make the memory space.
Other than that, you can name them whatever you want. But if you don't name them something that is descriptive, other programmers won't play with you. So no variable named "8sf97fwe", okay?

So go to the language reference/specification you found in the previous lesson and read the section on variables and types.

Task Discussion