Escolar Documentos
Profissional Documentos
Cultura Documentos
Variables are the area that the program stores the data that is inputted into the
program and they can be also used as a temporary storage area for data needed
during processing and the data output by a program would come from program
variables as well. When the program ends all the contents of variables are lost.
There are two main attributes of variables, one of which is a name, find the
variable inside of the program. The other attribute is a data type and what this is
that whatever variable the data can store the data type defines that data.
Global and local variables run a very important role in a program if you don’t
declare your variables at the beginning of the program the program will come up
with a lot of errors in the code but when u declare the variables then the
program understands the variables you have declared.
Global variables are used when you need the value outside of the range. Local
variables stop once the function that created them has ended; they are usually
needed in one part of the code.
Loops in a program are a set of instructions that need to be repeated a certain number of times or
when a criterion is met.
Dim B As Integer
B = 1
Do Until B = 4
MsgBox(B)
B = B + 1
Loop
Conditional statements
Conditional statement allows a choice to be made i.e. if to deal the next card or
not. “If” statement is usually used and also “elseif” statement.
If dealCounter = 1 Then
LblCard1.Visible = True
CmdDealer.Text = "Deal Card 2"
PontoonScore = PontoonScore + score
LblCard1.Text = Score
lblScore.Text = PontoonScore
ElseIf dealCounter = 2 Then
LblCard2.Visible = True
CmdDealer.Text = "Hit Me!"
PontoonScore = PontoonScore + score
LblCard2.Text = Score
LblCard5.Text = Score
lblScore.Text = Score & "Five Card Trick"
CmdDealer.Enabled = False
End If
Logical operators
E.g.
Operat Meaning
or
Assignment statement is when you can assign to certain variables; they can also be used by using
mathematical operators such as plus and minus. When you combine two operators then order of
execution is based on the actual order.
* Multiply 5* 7 = 35
/ Division 48 / 10 = 4.8
+ Add 52 + 55 = 107
Input and output in VB are usually done by a control (textbox, button etc) that
are placed on the form for the user to use.
For e.g. a user clicks a button on VB, the subroutine collects values that the user
has clicked the button and displays results.