Types of Conditional Structure

              – The conditional control structure is used to conditionally execute a set
                 of instructions.
               - Simple IF Statement

              – IF ELSE Statement

              – Nested IF ELSE statement

              – Ladder IF ELSE Statement

              – IF (Condition 1)
                       Statement 1;
                End IF
Example
               If DateTime.Now.Hour >= 6 And DateTime.Now.Hour < 12 Then
                     lblMessage.Text = “Good morning.”
                 End If
              
                 If DateTime.Now.Hour >= 12 And DateTime.Now.Hour <= 17 Then
                     lblMessage.Text = “Good afternoon.”
                 End If
                 If DateTime.Now.Hour > 17 Or DateTime.Now.Hour < 6 Then
                     lblMessage.Text = “Good evening.”
                 End If
The code for using an ElseIf and an Else looks like this:

Leave a Reply

Your email address will not be published. Required fields are marked *

6 + 4 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">