SlideShare ist ein Scribd-Unternehmen logo
1 von 9
Iteration
Using loops

 in VB.NET



              1
Loop structures
These are used when we want lines of code
to be executed many times
We might want it to run a set number of
times.
We may need to check if various conditions
have been met.
There are loops for all occasions and
programmers have their “favourites”!

                                             2
Fixed Loop structures
If we want the loop to run a fixed number
of times, we use a For…..Next loop
This will use a variable as a counter
Syntax:
  For first value To last value
      Line of code to execute
  Next value

                                            3
For...Next example




                     4
Conditional Loop Structures

If we want the loop to repeat until a
condition changes (at runtime).
Use While …. End While to check the
condition before running loop
Syntax:
   While condition = true
        Line of code execute
   End While
                                        5
While…End While example




                          6
Conditional Loop Structures
Use Do…. Loop to run until a condition
becomes true
This code will run at least once
 Beware! It is possible to create loops that
  carry on to infinity. Press Ctrl + Break to
  stop, but you may lose some unsaved work
Syntax:
   Do
      Line of code to execute
   Loop Until condition = true

                                                7
Do… Loop Until example




                         8
Programming terms
When we need to repeat a set of
instructions, we have 3 options:
 For….Next - runs for fixed number of loops
 While…End While - runs while condition is true
 Do…Loop Until - runs until condition becomes
  true


                                                   9

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Iteration Statement in C++
Iteration Statement in C++Iteration Statement in C++
Iteration Statement in C++
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script Trainings
 
Python loops
Python loopsPython loops
Python loops
 
Conditional Loops Python
Conditional Loops PythonConditional Loops Python
Conditional Loops Python
 
Looping and Switchcase BDCR
Looping and Switchcase BDCRLooping and Switchcase BDCR
Looping and Switchcase BDCR
 
Conditions In C# C-Sharp
Conditions In C# C-SharpConditions In C# C-Sharp
Conditions In C# C-Sharp
 
3.looping(iteration statements)
3.looping(iteration statements)3.looping(iteration statements)
3.looping(iteration statements)
 
VB Script
VB ScriptVB Script
VB Script
 
Java Decision Control
Java Decision ControlJava Decision Control
Java Decision Control
 
C# Loops
C# LoopsC# Loops
C# Loops
 
Conditional statements in vb script
Conditional statements in vb scriptConditional statements in vb script
Conditional statements in vb script
 
Vb script tutorial
Vb script tutorialVb script tutorial
Vb script tutorial
 
Introduction to VB.NET - UP SITF
Introduction to VB.NET - UP SITFIntroduction to VB.NET - UP SITF
Introduction to VB.NET - UP SITF
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
 
Loops
LoopsLoops
Loops
 
Program control statements in c#
Program control statements in c#Program control statements in c#
Program control statements in c#
 
Control structures pyhton
Control structures  pyhtonControl structures  pyhton
Control structures pyhton
 
Python if else statements (menard maranan)
Python if else statements (menard maranan)Python if else statements (menard maranan)
Python if else statements (menard maranan)
 
Programming Basics if then else, switch, operators
Programming Basics if then else, switch, operatorsProgramming Basics if then else, switch, operators
Programming Basics if then else, switch, operators
 
Basic vbscript for qtp
Basic vbscript for qtpBasic vbscript for qtp
Basic vbscript for qtp
 

Andere mochten auch

Control Structures in Visual Basic
Control Structures in  Visual BasicControl Structures in  Visual Basic
Control Structures in Visual BasicTushar Jain
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.netilakkiya
 
Event driven theory
Event driven theoryEvent driven theory
Event driven theorynickywalters
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)pbarasia
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programmingRoger Argarin
 
Control structures in Java
Control structures in JavaControl structures in Java
Control structures in JavaRavi_Kant_Sahu
 
Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowchartsnicky_walters
 
Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0Salim M
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecyclenicky_walters
 

Andere mochten auch (20)

Vb.net (loop structure)
Vb.net (loop structure)Vb.net (loop structure)
Vb.net (loop structure)
 
Control Structures in Visual Basic
Control Structures in  Visual BasicControl Structures in  Visual Basic
Control Structures in Visual Basic
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.net
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Controls
ControlsControls
Controls
 
Design for edp
Design for edpDesign for edp
Design for edp
 
Decisions
DecisionsDecisions
Decisions
 
Event driven theory
Event driven theoryEvent driven theory
Event driven theory
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
 
Control structures in Java
Control structures in JavaControl structures in Java
Control structures in Java
 
Control statements
Control statementsControl statements
Control statements
 
Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowcharts
 
Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0
 
Input output
Input outputInput output
Input output
 
Decisions
DecisionsDecisions
Decisions
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycle
 

Ähnlich wie Using loops

Intro to JavaScript - Week 3: Control Statements
Intro to JavaScript - Week 3: Control StatementsIntro to JavaScript - Week 3: Control Statements
Intro to JavaScript - Week 3: Control StatementsJeongbae Oh
 
Going loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptxGoing loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptxAmy Nightingale
 
loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docxJavvajiVenkat
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and loopingaprilyyy
 
Looping statements
Looping statementsLooping statements
Looping statementsJaya Kumari
 
Lec7 - Loops updated.pptx
Lec7 - Loops updated.pptxLec7 - Loops updated.pptx
Lec7 - Loops updated.pptxNaumanRasheed11
 
whileloop-161225171903.pdf
whileloop-161225171903.pdfwhileloop-161225171903.pdf
whileloop-161225171903.pdfBasirKhan21
 
While loop
While loopWhile loop
While loopFeras_83
 
Kotlin programming language
Kotlin programming languageKotlin programming language
Kotlin programming languageDSCMESCOE
 
Learning Solidity
Learning SolidityLearning Solidity
Learning SolidityArnold Pham
 
Decision Making & Loops
Decision Making & LoopsDecision Making & Loops
Decision Making & LoopsAkhil Kaushik
 

Ähnlich wie Using loops (20)

Ecma script
Ecma scriptEcma script
Ecma script
 
JavaScript iteration
JavaScript iterationJavaScript iteration
JavaScript iteration
 
Intro to JavaScript - Week 3: Control Statements
Intro to JavaScript - Week 3: Control StatementsIntro to JavaScript - Week 3: Control Statements
Intro to JavaScript - Week 3: Control Statements
 
Loop structures
Loop structuresLoop structures
Loop structures
 
Going loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptxGoing loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptx
 
loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docx
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
Looping statements
Looping statementsLooping statements
Looping statements
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
 
Lec7 - Loops updated.pptx
Lec7 - Loops updated.pptxLec7 - Loops updated.pptx
Lec7 - Loops updated.pptx
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Lesson 6 php if...else...elseif statements
Lesson 6   php if...else...elseif statementsLesson 6   php if...else...elseif statements
Lesson 6 php if...else...elseif statements
 
whileloop-161225171903.pdf
whileloop-161225171903.pdfwhileloop-161225171903.pdf
whileloop-161225171903.pdf
 
While loop
While loopWhile loop
While loop
 
VB Script Overview
VB Script OverviewVB Script Overview
VB Script Overview
 
Loops
LoopsLoops
Loops
 
Kotlin programming language
Kotlin programming languageKotlin programming language
Kotlin programming language
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
Learning Solidity
Learning SolidityLearning Solidity
Learning Solidity
 
Decision Making & Loops
Decision Making & LoopsDecision Making & Loops
Decision Making & Loops
 

Mehr von nicky_walters

Mehr von nicky_walters (10)

Design documentation
Design documentationDesign documentation
Design documentation
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
 
Event driventheory
Event driventheoryEvent driventheory
Event driventheory
 
Debugging
DebuggingDebugging
Debugging
 
Decisions
DecisionsDecisions
Decisions
 
Intro to visual studio 2008
Intro to visual studio 2008Intro to visual studio 2008
Intro to visual studio 2008
 
Input output
Input outputInput output
Input output
 

Using loops

  • 2. Loop structures These are used when we want lines of code to be executed many times We might want it to run a set number of times. We may need to check if various conditions have been met. There are loops for all occasions and programmers have their “favourites”! 2
  • 3. Fixed Loop structures If we want the loop to run a fixed number of times, we use a For…..Next loop This will use a variable as a counter Syntax: For first value To last value Line of code to execute Next value 3
  • 5. Conditional Loop Structures If we want the loop to repeat until a condition changes (at runtime). Use While …. End While to check the condition before running loop Syntax: While condition = true Line of code execute End While 5
  • 7. Conditional Loop Structures Use Do…. Loop to run until a condition becomes true This code will run at least once  Beware! It is possible to create loops that carry on to infinity. Press Ctrl + Break to stop, but you may lose some unsaved work Syntax: Do Line of code to execute Loop Until condition = true 7
  • 8. Do… Loop Until example 8
  • 9. Programming terms When we need to repeat a set of instructions, we have 3 options:  For….Next - runs for fixed number of loops  While…End While - runs while condition is true  Do…Loop Until - runs until condition becomes true 9