Conditional statement mean a set of instructions will be executed when a predefined condition occurs. For example if you want to show pass if student get 33 or more then 33 marks.
Or show failed if student got less then 33 marks. Here you have to write conditional statement. While working on a software application project we have to face many conditions appeared in program logics.
This is beauty of programming that can be used to check and set conditional execution. Let’s get one more example to know what a conditional statement is and how it works.
Imagine if we have a website and users are allowed to post comments to articles. One of users start bad comments and you want to stop it and don’t want him to comment again.
What you have to set in your programming code and how you will define conditions for that type of users. Yes here we will use conditional statement.
We will block the user to get login access and we will set the condition at login if user is blocked then he cant login. We mostly used if then else statement for this purpose.
But in our next lessons we will learn briefly about more conditional statements.
Below we will discuss how to write and use conditional statement using if then else.
Structure and parameters
Visual Basic has following types of conditional structures.