Chapter 2: Living with Variability — Declaring Value-Type Variables

In This Chapter

check.png Visiting the train station — the C# variable as storage locker

check.png Using integers — you can count on it

check.png Handling fractional values — what’s half a duck?

check.png Declaring other types of variables — dates, characters, strings

check.png Handling numeric constants — Π in the sky

check.png Changing types — cast doesn’t mean toss

check.png Letting the compiler figure out the type — var magic

The most fundamental of all concepts in programming is that of the variable. A C# variable is like a small box in which you can store things, particularly numbers, for later use. (The term variable is borrowed from the world of mathematics.)

Unfortunately for programmers, C# places several limitations on variables — limitations that mathematicians don’t have ...

Get C# 5.0 All-in-One For Dummies now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.