+ All Categories
Home > Education > Variables

Variables

Date post: 29-Jun-2015
Category:
Upload: peter-andrews
View: 318 times
Download: 0 times
Share this document with a friend
Popular Tags:
14
VARIABLES KING OF ALL PROGRAMMING CONCEPTS
Transcript
Page 1: Variables

VARIABLESKING OF ALL PROGRAMMING

CONCEPTS

Page 2: Variables

Variables are . . . .

IMPORTANT

Page 3: Variables

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

Page 4: Variables

Variable Names

ChampagneBucket

Variables have unique names that

make sense

Page 5: Variables

What can they Hold?

ChampagneBucket

Variables can hold anything!

Page 6: Variables

Example of Common Use For Variables in Programs

ChampagneBucket

NameCountAge

Programmers make use of Variables when they know something is going to change

Page 7: Variables

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?

Page 8: Variables

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!

Page 9: Variables

Data Types

ChampagneBucket

String IntegerDouble

Float Char

Boolean

Page 10: Variables

Reusable

The point of variables is that

they can be changed and

reused throughout the program

Page 11: Variables

Declaring Variables in VB

Dim name As String

There are 3 parts to declaring a variable

Page 12: Variables

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

Page 13: Variables

Declaring Variables in VB

Dim name As Stringname = “dave”

Associating something to the variable

The = symbols links name to Dave

Page 14: Variables

Using Variables in Programs Module Module1  Sub Main()  Dim name As String name = "Dave"  Console.WriteLine("hello" & name)  Console.ReadLine()   End Sub End Module


Recommended