class 3 remote instruction decision structures and global variables edu 556 programming for...

12
Class 3 Remote Instruction Decision Structures and Global Variables EDU 556 Programming for Instruction Dr. Steve Broskoske This is an audio PowerCast. Make sure your volume is turned up, and press F5 to begin. Click to advance as usual.

Upload: gertrude-norman

Post on 02-Jan-2016

217 views

Category:

Documents


2 download

TRANSCRIPT

Class 3 Remote Instruction Logic

Class 3 Remote InstructionDecision Structures andGlobal VariablesEDU 556 Programming for InstructionDr. Steve BroskoskeThis is an audio PowerCast. Make sure your volume is turned up, and press F5 to begin. Click to advance as usual.

Global VariablesRemember there are 3 places you can declare a variable, depending on how long you want the variable to live.Whole program (globaldeclare in a module).Form (declare on top of form).Button (declare within button procedure/coding).

To Declare a Global VariableSelect add new itemmodule.The module will appear in the Solution Explorer.Only code on module; no design.Declare the global variable in the module using the following coding:

Friend variable_name As type

Global Variable ExampleIncrement Global Counter5NextIncrement Global Counter6NextglobalCounter = globalCounter + 1lblOutput.Text = globalCounter

Decision StructuresIf condition Then statementExample:If score >= 70 ThenlblOutput.text = passEnd If

Decision StructuresIf condition Then statement Else statementExample:If score >= 70 ThenlblOutput.text = passElselblOutput.text = failEnd If

Conditional StatementsConditions= (equal to) (not equal to)> (greater than)< (less than)>= (greater than or equal to) 21 ThenIf numCorrect < 3 ThenIf score >= 70 ThenIf answer