Showing posts with label Control Flow Statements:. Show all posts
Showing posts with label Control Flow Statements:. Show all posts

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


Control Flow Statements:


       VB.Net मे control flow statements Program के flow को control करती है। यह प्रोग्राम मे use होने वाले data को control करती हैं। यह statements दो प्रकार की होती है।

  • Conditional Statements
  • Looping Statements
·       Conditional Statements:
                                     VB.Net मे conditional statements का use conditions को check करने के लिए किया जाता है। यह मुख्यतः तीन प्रकार की होती है। 
  • If- Then 
  • If – Then – Else 
  • Select Case 

1. If- Then : if-then statement का use normal conditions check करने के लिए किया जाता है। इसमे लिखी गई condition के ture होने पर If- End If block की statements execute हो जाती है। और condition false होने पर control बाहर चला जाता है।


Syntax- 

           If Condition Then
                     Statements 
           End If 


Ex- If a > b Then 

               Msgbox (“A is greater”)

       End If


Contact us

Name

Email *

Message *