BHAILOG PROGRAMMER
  • Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Home
  • C++ PROGRAM
  • Java Program
  • VB.NET PROGRAM
  • ANDROID
  • SQL
  • Q/A
  • Books

Saturday, January 12, 2019

VB.Net - If...Then Statement

 BHAILOG     January 12, 2019     VB.NET PROGRAM     No comments   

VB.Net - If...Then Statement




It is the simplest form of control statement, frequently used in decision making and changing the control flow of the program execution. Syntax for if-then statement is −

If condition Then 
[Statement(s)]
End If

Where, condition is a Boolean or relational condition and Statement(s) is a simple or compound statement. Example of an If-Then statement is −

If (a <= 20) Then
   c= c+1
End If

If the condition evaluates to true, then the block of code inside the If statement will be executed. If condition evaluates to false, then the first set of code after the end of the If statement (after the closing End If) will be executed.


VB.NET PROGRAM 


Module Module1
   Sub Main()
      'local variable definition 
      Dim a As Integer = 10
      ' check the boolean condition using if statement 
      If (a < 20) Then
         ' if condition is true then print the following 
         Console.WriteLine("a is less than 20")
      End If
      Console.WriteLine("value of a is : {0}", a)
      Console.ReadLine()
    End Sub
End Module


When the above code is compiled and executed, it produces the following result −

a is less than 20
value of a is : 10





If you liked the tutorial then don’t forget to comment and share!
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Popular

  • WINTER – 2018 EXAMINATION
    WINTER – 2018 EXAMINATION
    WINTER – 2018 EXAMINATION  MODEL ANSWER MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION DOWNLOAD PDF Information Technology Department...
  • VB.Net program
    VB.Net program
    VB.Net PROGRAM VB.Net Hello World Example Let us look at a simple code that would print the words "Hello World" − I...

Translate

About Me

indian-choice
View my complete profile

Followers

  • Home
  • C++ PROGRAM
  • Java Program
  • VB.NET PROGRAM
  • ANDROID
  • SQL
  • Q&A
  • Books

BLOG

  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us

Copyright © BHAILOG PROGRAMMER | Powered by Bhailog Programmer
Design by Mohit and Pravin