Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
34 views

Programing in Visual Basic 2010 59

Variables are storage containers that programs create to store different types of data, like numbers, text, and dates, with each type designed for a specific kind of information. Programs must first declare variables to create these storage containers before assigning values to them and changing what is stored in each one. Declaring variables establishes them with a data type and name according to the strict syntax rules that programming languages require.

Uploaded by

mudassir2640
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Programing in Visual Basic 2010 59

Variables are storage containers that programs create to store different types of data, like numbers, text, and dates, with each type designed for a specific kind of information. Programs must first declare variables to create these storage containers before assigning values to them and changing what is stored in each one. Declaring variables establishes them with a data type and name according to the strict syntax rules that programming languages require.

Uploaded by

mudassir2640
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

39

Variables and Constants A Place for Everything and Everything in Its Place

Jefferson
5.95
24

bytNumCans
Figure 2.1

75

shoLength

decPrice

strLastName

Storage Containers

of storing items. Each one has a name, and each stores only one item. We can
see whats in each container maybe a number or some text. The programs we
write will create the containers, put values in them, and change whats stored in
each container. They could look like Figure 2.1.
VB Quiz 01

Larry Wall once said, Dont tell me there isnt one bit of difference between null and
space because thats exactly how much difference there is. Use the ASCII chart to
explain why hes right.
Computer memory has been compared to cups and jars. What else could be used
in an analogy for computer memory?

Creating Variables: Storage Containers for Your Data


Data Types
To work with data on your computer anything from the text that is your name
or your address, to numbers like your age or a test score, and to dates like your
birthday or graduation date you must use a variable. A variable is a storage
container for your data. Many types of variables exist, each with a specific use,
or what programmers call a data type. That is, each type is designed to store a
particular type of data. Some store whole numbers, integers. Some store numbers
with decimals. Some are for dates; some store text, in what programmers call
strings. There are a few other types as well, but, for now, well stick with a few
basic data types.
To make use of these containers, you first have to create them. In programming
this is called declaration. You write a statement that creates a variable. To change
the value in a variable, use an assignment. This is where the rules of programming
take over, in whats called syntax. Nearly every statement you write in your code
has to follow very strict rules. Often the hardest part of programming is getting
your commands written in a way the computer understands. For the most part,
well try very hard to keep it simple. First, lets look at declarations.

You might also like