VB Variables and Operators
VB Variables and Operators
intX = 1 intY = 2
intResult = intX + intY
strOutput = intX & “ + “ & intY & “ = “ & intResult “1 + 2 = 3”
Often need to change the value in a variable and
assign the result back to that variable
For example: var = var – 5
Subtracts 5 from the value stored in var
intX = 10
intY = 5
intResultA = intX + intY * 5 'iResultA is 35
iResultB = (intX + intY) * 5 'iResultB is 75
dResultA = intX - intY * 5 'dResultA is -15
dResultB = (intX - intY) * 5 'dResultB is 25
Redo the Calculate Gross Pay example from
Lecture 4 using variables.
Redo the Calculator from HW2 using
variables.