Journal of a Geek

Programming Basics: Variables

with one comment

One of the most important concepts in programming is the variable. A variable in programming works pretty much the same way it does in algebra. A variable represents some unknown. This comes in very handy when you are writing algorithms whether in math or computer programming. For example:

x + 2

In this case, we are adding two to whatever x contains. The variable could be given a value from many different places, but in general the value is given to the variable through what is called an assignment operator. In most programming languages this operator is the equal sign.

x = 2

Here we have given the variable x the value of two. The assignment goes from right to left. So the value on the right is given to the value on the left.

Variables are very important when moving on to much more complex operations such as conditional statements and loops. The next post in this series will talk about conditional statements.


Written by Ryan Farnell

September 27, 2006 at 5:53 pm

Posted in Programming

One Response

Subscribe to comments with RSS.

  1. Looking forward to the next one…


    September 29, 2006 at 10:39 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: