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...Else Statement

 BHAILOG     January 12, 2019     VB.NET PROGRAM     No comments   



VB.Net - If...Then...Else Statement



An If statement can be followed by an optional Else statement, which executes when the Boolean expression is false.

Syntax

The syntax of an If...Then... Else statement in VB.Net is as follows −

If(boolean_expression)Then
   'statement(s) will execute if the Boolean expression is true 
Else
  'statement(s) will execute if the Boolean expression is false 
End If

If the Boolean expression evaluates to true, then the if block of code will be executed, otherwise else block of code will be executed.



VB.NET PROGRAM


Module Module1
   Sub Main()
       'local variable definition '
      Dim a As Integer = 100
      ' 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")
      Else
          ' if condition is false then print the following 
          Console.WriteLine("a is not 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 −
None of the value is matching
value of a is : 100 




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