Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

2. It’s All Just Code: Under the hood > Your programs use variables to work wit...

Your programs use variables to work with data

When you get right down to it, every program is basically a data cruncher. Sometimes the data is in the form of a document, or an image in a video game, or an instant message. But it’s all just data. And that’s where variables come in. A variable is what your program uses to store data.

Declare your variables

Whenever you declare a variable, you tell your program its type and its name. Once C# knows your variable’s type, it’ll keep your program from compiling if you make a mistake and try to do something that doesn’t make sense, like subtract “Fido” from 48353.

image with no caption

Watch it!

Are you already familiar with another language?

If so, you might find a few things in this chapter seem really familiar. Still, it’s worth taking the time to run through the exercises anyway, because there may be a few ways that C# is different from what you’re used to.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial