SlideShare a Scribd company logo
Conditional Statement IF Condition   Syntax for If Condition If (Condition) Then Statement 


. Else   Statement 


. Example Dim percentage As Integer WriteLine("Enter the percentage") percentage = Val(ReadLine()) If percentage >= 75 Then WriteLine("Qualified for sitting examination") Else WriteLine("Not Qualified for sitting examination") End If Read()
If Condition & Select Case Statement The first line contains our condition: "If the following condition is met".  The second line is what we want to do if the condition is indeed met. The third line tells Visual Basic that the If statement ends right here. Select....Case Statement  The Select Case statement executes one of several groups of statements depending on the value of an expression. If your code has the capability to handle different values of a particular variable then you can use a Select Case statement. You use Select Case to test an expression, determine which of the given cases it matches and execute the code in that matched case. The syntax of the Select Case statement looks like this:  Select Case testexpression     [Case expressionlist-n         [statements-n]] . . .     [Case Else elsestatements] End Select
Select Case Statement Example   Imports System.Console Dim keyIn As Integer WriteLine("Enter a number between 1 and 4")  keyIn = Val(ReadLine()) Select Case keyIn Case 1 WriteLine("You entered 1") Case 2 WriteLine("You entered 2") Case 3 WriteLine("You entered 3") Case 4 WriteLine("You entered 4") End Select
Loops in VB.Net For LOOP The For loop is the most popular loop. For loops enable us to execute a series of expressions multiple numbers of times. The For loop in VB .NET needs a loop index which counts the number of loop iterations as the loop executes. The syntax for the For loop looks like this:  Syntax for FOR LOOP For index=start to end[Step step] [statements] [Exit For] [statements] Next[index]
Loops in VB.Net Example on For loop  Module Module1 Sub Main() Dim d As Integer For d = 0 To 2 System.Console.WriteLine("In the For Loop") Next d End Sub End Module  While loop  While loop keeps executing until the condition against which it tests remain true.  The syntax of while loop looks like this:  While condition [statements] End While
Loops in VB.Net Example on For loop  Module Module1 Sub Main() Dim d As Integer For d = 0 To 2 System.Console.WriteLine("In the For Loop") Next d End Sub End Module  While loop  While loop keeps executing until the condition against which it tests remain true.  The syntax of while loop looks like this:  While condition [statements] End While
Loops in VB.Net Example for While Loop ‘ Imports System.Console Module Module1 Sub Main() Dim e As Integer While e <= 3 e = e + 1 System.Console.WriteLine(&quot;The Loop ran &quot; & e & &quot;times&quot;) End While Read() End Sub End Module
Loops in VB.Net Do Loop  The Do loop can be used to execute a fixed block of statements indefinite number of times. The Do loop keeps executing it's statements while or until the condition is true. Two keywords, while and until can be used with the do loop. The Do loop also supports an Exit Do statement which makes the loop to exit at any moment.  The syntax of Do loop looks like this:  Do[{while | Until} condition] [statements] [Exit Do] [statements] Loop
Loops in VB.Net Example on Do loop  Module Module1 Sub Main() Dim str As String Do Until str = &quot;Cool&quot; System.Console.WriteLine(&quot;What to do?&quot;) str = System.Console.ReadLine() Loop End Sub End Module

More Related Content

PPT
Vb
Rajeev Sharan
 
PPT
ppt on scanner class
deepsxn
 
DOCX
Bitstuffing
Vishal Kr
 
DOCX
Write and write line methods
Dr.M.Karthika parthasarathy
 
PPT
C# basics
Dinesh kumar
 
PPTX
C# Tutorial
Jm Ramos
 
PPSX
C# - Part 1
Md. Mahedee Hasan
 
PPTX
java in Aartificial intelligent by virat andodariya
viratandodariya
 
ppt on scanner class
deepsxn
 
Bitstuffing
Vishal Kr
 
Write and write line methods
Dr.M.Karthika parthasarathy
 
C# basics
Dinesh kumar
 
C# Tutorial
Jm Ramos
 
C# - Part 1
Md. Mahedee Hasan
 
java in Aartificial intelligent by virat andodariya
viratandodariya
 

What's hot (18)

PDF
Introduction to c first week slides
luqman bawany
 
PPTX
The Little Wonders of C# 6
BlackRabbitCoder
 
PDF
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Azilen Technologies Pvt. Ltd.
 
PDF
OOPS With CSharp - Jinal Desai .NET
jinaldesailive
 
PPT
C# features
sagaroceanic11
 
PPTX
Java 8
AbhimanuHandoo
 
PPTX
Conditions In C# C-Sharp
Abid Kohistani
 
PPTX
C language (Part 2)
Dr. SURBHI SAROHA
 
PDF
overview of c#
Kandreo Gotro
 
PDF
First Class
A R M Abdullah Rocky
 
PDF
Xtext: code generation
Mikhail Barash
 
PPT
Basic input-output-v.1.1
BG Java EE Course
 
PPTX
Test driven development
Xebia India
 
PPTX
Chapter one
kiran acharya
 
PPTX
C# lecture 2: Literals , Variables and Data Types in C#
Dr.Neeraj Kumar Pandey
 
PPTX
if, while and for in Python
PranavSB
 
PPTX
Functional programming in TypeScript
binDebug WorkSpace
 
Introduction to c first week slides
luqman bawany
 
The Little Wonders of C# 6
BlackRabbitCoder
 
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Azilen Technologies Pvt. Ltd.
 
OOPS With CSharp - Jinal Desai .NET
jinaldesailive
 
C# features
sagaroceanic11
 
Java 8
AbhimanuHandoo
 
Conditions In C# C-Sharp
Abid Kohistani
 
C language (Part 2)
Dr. SURBHI SAROHA
 
overview of c#
Kandreo Gotro
 
First Class
A R M Abdullah Rocky
 
Xtext: code generation
Mikhail Barash
 
Basic input-output-v.1.1
BG Java EE Course
 
Test driven development
Xebia India
 
Chapter one
kiran acharya
 
C# lecture 2: Literals , Variables and Data Types in C#
Dr.Neeraj Kumar Pandey
 
if, while and for in Python
PranavSB
 
Functional programming in TypeScript
binDebug WorkSpace
 
Ad

Viewers also liked (20)

PPTX
Total service management
Rajeev Sharan
 
PPT
Ergonomics
Rajeev Sharan
 
PPT
Vb (1)
Rajeev Sharan
 
PPSX
product analysis & development- sourcing
Rajeev Sharan
 
PPTX
Product Analysis & Development
Rajeev Sharan
 
PPTX
Professional practices
Rajeev Sharan
 
PPT
Supply chain management
Rajeev Sharan
 
DOCX
Human resource management
Rajeev Sharan
 
DOCX
Customer relationship management
Rajeev Sharan
 
PPS
E smartx.ppt
Rajeev Sharan
 
PDF
Calculator code
Rajeev Sharan
 
PDF
IPR
Rajeev Sharan
 
PDF
Rajeev oops 2nd march
Rajeev Sharan
 
PDF
P 10 p-4ac756g50(gb )
Rajeev Sharan
 
PPT
Supply chain management
Rajeev Sharan
 
DOC
RECENT TRENDS OF MAINTENANCE MANAGEMENT
Rajeev Sharan
 
PDF
Inventory management
Rajeev Sharan
 
PPTX
Lean- automobile
Rajeev Sharan
 
PDF
Declaring friend function with inline code
Rajeev Sharan
 
PDF
INVENTORY OPTIMIZATION
Rajeev Sharan
 
Total service management
Rajeev Sharan
 
Ergonomics
Rajeev Sharan
 
Vb (1)
Rajeev Sharan
 
product analysis & development- sourcing
Rajeev Sharan
 
Product Analysis & Development
Rajeev Sharan
 
Professional practices
Rajeev Sharan
 
Supply chain management
Rajeev Sharan
 
Human resource management
Rajeev Sharan
 
Customer relationship management
Rajeev Sharan
 
E smartx.ppt
Rajeev Sharan
 
Calculator code
Rajeev Sharan
 
Rajeev oops 2nd march
Rajeev Sharan
 
P 10 p-4ac756g50(gb )
Rajeev Sharan
 
Supply chain management
Rajeev Sharan
 
RECENT TRENDS OF MAINTENANCE MANAGEMENT
Rajeev Sharan
 
Inventory management
Rajeev Sharan
 
Lean- automobile
Rajeev Sharan
 
Declaring friend function with inline code
Rajeev Sharan
 
INVENTORY OPTIMIZATION
Rajeev Sharan
 
Ad

Similar to Vb (2) (20)

PPTX
BSc. III Unit iii VB.NET
Ujwala Junghare
 
PPTX
Looping statements
Jaya Kumari
 
PPTX
Unit IV Array in VB.Net.pptx
Ujwala Junghare
 
PDF
Conditional Statements & Loops
simmis5
 
PPTX
CONTROL STRUCTURE IN VB
classall
 
PPTX
Vb.net (loop structure)
Abhishek Pachisia
 
PDF
Do...Loop
Muhammad Al Fatih
 
PPTX
Data structures vb
nicky_walters
 
PPT
05 control structures 2
Jomel Penalba
 
PPTX
Looping statement in vb.net
ilakkiya
 
PPTX
Advanced VB: Review of the basics
robertbenard
 
PPTX
Advanced VB: Review of the basics
robertbenard
 
PPTX
Loop control statements
Jaya Kumari
 
DOC
Conditional statements in vb script
Nilanjan Saha
 
PDF
Loops in Visual Basic Programming
Kasun Ranga Wijeweera
 
PPTX
VB(unit1).pptx
sudharsanm56
 
PDF
VB PPT by ADI PART3.pdf
Prof. Dr. K. Adisesha
 
PDF
VB PPT by ADI PART3.pdf
AdiseshaK
 
DOCX
VBS control structures for if do whilw.docx
Ramakrishna Reddy Bijjam
 
PPT
03 intro to vb programming
Jomel Penalba
 
BSc. III Unit iii VB.NET
Ujwala Junghare
 
Looping statements
Jaya Kumari
 
Unit IV Array in VB.Net.pptx
Ujwala Junghare
 
Conditional Statements & Loops
simmis5
 
CONTROL STRUCTURE IN VB
classall
 
Vb.net (loop structure)
Abhishek Pachisia
 
Do...Loop
Muhammad Al Fatih
 
Data structures vb
nicky_walters
 
05 control structures 2
Jomel Penalba
 
Looping statement in vb.net
ilakkiya
 
Advanced VB: Review of the basics
robertbenard
 
Advanced VB: Review of the basics
robertbenard
 
Loop control statements
Jaya Kumari
 
Conditional statements in vb script
Nilanjan Saha
 
Loops in Visual Basic Programming
Kasun Ranga Wijeweera
 
VB(unit1).pptx
sudharsanm56
 
VB PPT by ADI PART3.pdf
Prof. Dr. K. Adisesha
 
VB PPT by ADI PART3.pdf
AdiseshaK
 
VBS control structures for if do whilw.docx
Ramakrishna Reddy Bijjam
 
03 intro to vb programming
Jomel Penalba
 

More from Rajeev Sharan (15)

PDF
Graduation Project (SA 8000 & it's frame work for Indian Apparel Manufacturing)
Rajeev Sharan
 
PDF
Final pl doc
Rajeev Sharan
 
PPT
Production module-ERP
Rajeev Sharan
 
PDF
Maintenance management
Rajeev Sharan
 
PPTX
Maintenance management
Rajeev Sharan
 
PPSX
Maintenance management
Rajeev Sharan
 
DOC
PAD FINAL DOC
Rajeev Sharan
 
PDF
Shirt spec sheet
Rajeev Sharan
 
DOCX
Ergonomics
Rajeev Sharan
 
PPT
Report writing.....
Rajeev Sharan
 
PPTX
Business ethics @ tata
Rajeev Sharan
 
PPTX
Software maintenance
Rajeev Sharan
 
PPT
Software quality assurance
Rajeev Sharan
 
DOC
SETTING UP OF A GARMENT INDUSTRY
Rajeev Sharan
 
PDF
SPME
Rajeev Sharan
 
Graduation Project (SA 8000 & it's frame work for Indian Apparel Manufacturing)
Rajeev Sharan
 
Final pl doc
Rajeev Sharan
 
Production module-ERP
Rajeev Sharan
 
Maintenance management
Rajeev Sharan
 
Maintenance management
Rajeev Sharan
 
Maintenance management
Rajeev Sharan
 
PAD FINAL DOC
Rajeev Sharan
 
Shirt spec sheet
Rajeev Sharan
 
Ergonomics
Rajeev Sharan
 
Report writing.....
Rajeev Sharan
 
Business ethics @ tata
Rajeev Sharan
 
Software maintenance
Rajeev Sharan
 
Software quality assurance
Rajeev Sharan
 
SETTING UP OF A GARMENT INDUSTRY
Rajeev Sharan
 

Recently uploaded (20)

DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Basics and rules of probability with real-life uses
ravatkaran694
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 

Vb (2)

  • 1. Conditional Statement IF Condition Syntax for If Condition If (Condition) Then Statement 


. Else Statement 


. Example Dim percentage As Integer WriteLine(&quot;Enter the percentage&quot;) percentage = Val(ReadLine()) If percentage >= 75 Then WriteLine(&quot;Qualified for sitting examination&quot;) Else WriteLine(&quot;Not Qualified for sitting examination&quot;) End If Read()
  • 2. If Condition & Select Case Statement The first line contains our condition: &quot;If the following condition is met&quot;. The second line is what we want to do if the condition is indeed met. The third line tells Visual Basic that the If statement ends right here. Select....Case Statement The Select Case statement executes one of several groups of statements depending on the value of an expression. If your code has the capability to handle different values of a particular variable then you can use a Select Case statement. You use Select Case to test an expression, determine which of the given cases it matches and execute the code in that matched case. The syntax of the Select Case statement looks like this: Select Case testexpression     [Case expressionlist-n         [statements-n]] . . .     [Case Else elsestatements] End Select
  • 3. Select Case Statement Example Imports System.Console Dim keyIn As Integer WriteLine(&quot;Enter a number between 1 and 4&quot;) keyIn = Val(ReadLine()) Select Case keyIn Case 1 WriteLine(&quot;You entered 1&quot;) Case 2 WriteLine(&quot;You entered 2&quot;) Case 3 WriteLine(&quot;You entered 3&quot;) Case 4 WriteLine(&quot;You entered 4&quot;) End Select
  • 4. Loops in VB.Net For LOOP The For loop is the most popular loop. For loops enable us to execute a series of expressions multiple numbers of times. The For loop in VB .NET needs a loop index which counts the number of loop iterations as the loop executes. The syntax for the For loop looks like this: Syntax for FOR LOOP For index=start to end[Step step] [statements] [Exit For] [statements] Next[index]
  • 5. Loops in VB.Net Example on For loop Module Module1 Sub Main() Dim d As Integer For d = 0 To 2 System.Console.WriteLine(&quot;In the For Loop&quot;) Next d End Sub End Module While loop While loop keeps executing until the condition against which it tests remain true. The syntax of while loop looks like this: While condition [statements] End While
  • 6. Loops in VB.Net Example on For loop Module Module1 Sub Main() Dim d As Integer For d = 0 To 2 System.Console.WriteLine(&quot;In the For Loop&quot;) Next d End Sub End Module While loop While loop keeps executing until the condition against which it tests remain true. The syntax of while loop looks like this: While condition [statements] End While
  • 7. Loops in VB.Net Example for While Loop ‘ Imports System.Console Module Module1 Sub Main() Dim e As Integer While e <= 3 e = e + 1 System.Console.WriteLine(&quot;The Loop ran &quot; & e & &quot;times&quot;) End While Read() End Sub End Module
  • 8. Loops in VB.Net Do Loop The Do loop can be used to execute a fixed block of statements indefinite number of times. The Do loop keeps executing it's statements while or until the condition is true. Two keywords, while and until can be used with the do loop. The Do loop also supports an Exit Do statement which makes the loop to exit at any moment. The syntax of Do loop looks like this: Do[{while | Until} condition] [statements] [Exit Do] [statements] Loop
  • 9. Loops in VB.Net Example on Do loop Module Module1 Sub Main() Dim str As String Do Until str = &quot;Cool&quot; System.Console.WriteLine(&quot;What to do?&quot;) str = System.Console.ReadLine() Loop End Sub End Module