Showing posts with label conditional statements. Show all posts
Showing posts with label conditional statements. Show all posts

Monday, January 28, 2013


 Select Case: Select Case statement का use किसी expression की value को अलग अलग cases पर check करने के लिए किया जाता है। इसमे select case मे लिखी गई expression की value cases के साथ match की जाती हैं और सही match found होने पर उस block की statement execute हो जाती है। किसी case के match न होने पर Case Else की statement execute होती है।


Syntax-       Select Case textexpression
           Case ExpressionList………N
                [‘Statements … … N]]
           [Case Else
                [Statement Else]]
           End Select


 Ex-         Select Case Now.DayOfWeek
                      Case DayOfWeek.Sunday
                       MsgBox("Its Time to Enjoy")
                      Case DayOfWeek.Monday
                       MsgBox("Have a nice week")
                      Case Else
                       MsgBox("Enjoy this week")
           End Select

Monday, January 21, 2013


Else- If Ladder: 


          यह if-then-else का ही extended form है जिसमे multiple conditions और multiple results के लिए use किया जाता है। इसमे एक condition के false होने पर second, second के false होने पर third statement execute होती है और किसी के true न होने पर Else block execute होता है।
Syntax-
If condition1 Then
          ‘Statements1
ElseIf condition2 then
          ‘Statement2
ElseIf condition3 then
          ‘Statement3
ElseIf Condition N Then
          ‘Statement N
Else
          ‘Statement Else
End If
Ex-           Dim per As Decimal
per = Val(TextBox1.Text)
If per > 60 Then
MsgBox("Firse")
ElseIf per > 50 Then
MsgBox("Second")
ElseIf per > 40 Then
MsgBox("Third")
Else
MsgBox("Fail")
End If

Contact us

Name

Email *

Message *