Date post: | 29-Jun-2015 |
Category: |
Education |
Upload: | peter-andrews |
View: | 318 times |
Download: | 0 times |
VARIABLESKING OF ALL PROGRAMMING
CONCEPTS
Variables are . . . .
IMPORTANT
What are Variables?
A variable is a named value that changes its contents while the program runs.
You can think of a variable like a
bucket. A bucket those contents can
changeaVariable
Variable Names
ChampagneBucket
Variables have unique names that
make sense
What can they Hold?
ChampagneBucket
Variables can hold anything!
Example of Common Use For Variables in Programs
ChampagneBucket
NameCountAge
Programmers make use of Variables when they know something is going to change
Example of Common Use For Variables in Programs
ChampagneBucket
I’m holding the answer
to that!ITS DAVE!
Name
What’s the name of the
current user?
Data types
ChampagneBucket
Variables have a data typeI’m the type of
Variable that holds only
Champagne ! Don’t you try
and put Lemonade in
me!
Data Types
ChampagneBucket
String IntegerDouble
Float Char
Boolean
Reusable
The point of variables is that
they can be changed and
reused throughout the program
Declaring Variables in VB
Dim name As String
There are 3 parts to declaring a variable
Declaring Variables in VB
Dim name As String
Dim is written below declaring
all variables
All variables should be
declared as a data type
All variable’s have a name
Declaring Variables in VB
Dim name As Stringname = “dave”
Associating something to the variable
The = symbols links name to Dave
Using Variables in Programs Module Module1 Sub Main() Dim name As String name = "Dave" Console.WriteLine("hello" & name) Console.ReadLine() End Sub End Module