Looping Statement In Visual Basic In Hindi

Looping Statement In Visual Basic In Hindi
2.4/5 - (21 votes)

Looping Statement In Visual Basic In Hindi– हेल्लो Engineers कैसे हो , उम्मीद है आप ठीक होगे और पढाई तो चंगा होगा आज जो शेयर करने वाले वो Visual Basic  केLooping Statement In Visual Basic In Hindi के बारे में हैं, तो यदि आप जानना चाहते हैं की Looping Statement In Visual Basic In Hindi क्या हैं तो आप इस पोस्ट को पूरा पढ़ सकते हैं , और अगर समझ आ जाये तो अपने दोस्तों से शेयर कर सकते हैं |

Looping Statement In Visual Basic In Hindi

Looping Statement In Visual Basic In Hindi
Looping Statement In Visual Basic In Hindi

Looping Statement In Visual Basic In Hindi

Visual Basic लूप structure आपको code key एक या एक से अधिक line को दोहराए जाने की अनुमति देती हैं।
आप लूप structure में statement को तब तक दोहरा सकते हैं जब तक कि  कोई condition false न हो |
Looping Statement In Visual Basic In Hindi
Looping Statement In Visual Basic In Hindi

Note:-

1) Do While Loop Statement

Do while  लूप का उपयोग तब किया जाता है जब हम स्टेटमेंट को सही साबित करना चाहते हैं | हलाकि लूप की शुरुआत में या लूप के अंत में जाँच की जा सकती है।

syntax of Do While Loop

Do While condition
    statementblock
Loop

Example

<script type="text/vbscript">
Dim x
x=1
Do While x<5
document.write("Welcome.")
x=x+1
Loop
</script>

Output

VBScript Loops - Do While, Do Until, While, For Each

2) Do Until Loop Statement

‘Do Until Loop’ लूप का उपयोग तब किया जाता है जब आपको कोड के ब्लॉक को execute करने की आवश्यकता के बारे में पता नहीं होता है |

syntax of Do While Loop

Do until condition
    statementblock
Loop

Example

<script type="text/vbscript">
Dim x
x=1
Do Until x=5
document.write("Welcome.")
x=x+1
Loop
</script>

Output

VBScript Loops - Do While, Do Until, While, For Each

दिए गए example में जबतक x का value 5 नहीं हो जाता तबतक loop चलते रहेगा  |

3 ) For-Next Loop Statement

For-Next loop का प्रयोग किसे block के code को एक निश्चित संख्या (specific number of times )में execute कराया जाता है | VBScript For loop  एक variable लेता हैं जिसमे loop का  एक starting और एक ending vale होता हैं |

Example

For i = 1 To 5
  document.write("The number is " & i & "
")
Next

Output

VBScript Loops - Do While, Do Until, While, For Each

दिए गए example में जब तक x का value 5 नहीं हो जाता तबतक loop चलते रहेगा  |

3 ) For-Each-Next Loop Statement

यदि आप किसी collection  में या visual basic array  के प्रत्येक elements  के लिए कोड का एक ब्लॉक दोहराना चाहते हैं, तो आपको इसके लिए उपयोग करने की आवश्यकता है

Example

<script type="text/vbscript">
Dim students(4)
students(0)="John"
students(1)="Hanah"
students(2)="Sarah"
students(3)="Kevin"
students(4)="Emma"

For Each x In students
  document.write(x & "<br />")
Next
</script>

Output

VBScript Loops - Do While, Do Until, While, For Each

4 )While….Wend Loop Statement

Wend Loop भी  Do Loop की तरह सामान होता है  | इसका syntax निम्लिखित है |

While condition
  Statements
 Wend
उपरोक्त loop का अर्थ है कि जब condition पूरी नहीं होगी , loop चालू रहेगा। condition पूरी होने पर loop समाप्त हो जाएगा | 

Example

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         Dim Counter :  Counter = 10   
         While Counter < 15    ' Test value of Counter.
            Counter = Counter + 1   ' Increment Counter.
            document.write("The Current Value of the Counter is : " & Counter)
            document.write("<br></br>")
         Wend ' While loop exits if Counter Value becomes 15.
         
      </script>
   </body>
</html>

Output

The Current Value of the Counter is : 11 

The Current Value of the Counter is : 12 

The Current Value of the Counter is : 13 

The Current Value of the Counter is : 14 

The Current Value of the Counter is : 15

5) Nested For Loop Statement

Visual Basic आपको यह सुविधा देता है की आप  loop के अंदर भी  loop का प्रयोग कर सकते हैं , इसे हम  Nested  Loop Statement भी कहते है |

syntax of Nested For Loop

For counter1 [ As datatype1 ] = start1 To end1 [ Step step1 ]
   For counter2 [ As datatype2 ] = start2 To end2 [ Step step2 ]
      ...
   Next [ counter2 ]
Next [ counter 1]

nested While loop syntax

While condition1
   While condition2
      ...
   End While
End While

syntax of nested Do...While loop

Do { While | Until } condition1
   Do { While | Until } condition2
      ...
   Loop
Loop

Example

हम nested for loop की मदद से 1 से 100 के बिच prime number find करेंगे | 

Module loops
   Sub Main()
      ' local variable definition 
      Dim i, j As Integer
      For i = 2 To 100
         For j = 2 To i
            ' if factor found, not prime
            If ((i Mod j) = 0) Then
               Exit For
            End If
         Next j
            If (j > (i \ j)) Then
               Console.WriteLine("{0} is prime", i)
            End If
         Next i
      Console.ReadLine()
   End Sub
End Module

Output

2 is prime
3 is prime
5 is prime
7 is prime
11 is prime
13 is prime
17 is prime
19 is prime
23 is prime
29 is prime
31 is prime
37 is prime
41 is prime
43 is prime
47 is prime
53 is prime
59 is prime
61 is prime
67 is prime
71 is prime
73 is prime
79 is prime
83 is prime
89 is prime
97 is prime

Final Word

दोस्तों इस पोस्ट को पूरा पढने के बाद आप तो ये समझ गये होंगे की Looping Statement In Visual Basic In Hindiऔर आपको जरुर पसंद आई होगी , मैं हमेशा यही कोशिश करता हु की आपको सरल भाषा में समझा सकू , शायद आप इसे समझ गये होंगे इस पोस्ट में मैंने सभी Topics को Cover किया हूँ ताकि आपको किसी और पोस्ट को पढने की जरूरत ना हो , यदि इस पोस्ट से आपकी हेल्प हुई होगी तो अपने दोस्तों से शेयर कर सकते हैं|

2 Trackbacks / Pingbacks

  1. MsgBox & Input Box In VB हिंदी में - MsgBox And Input Box In VB In Hindi
  2. विजुअल बेसिक Module हिंदी में - Modules In VB In Hindi

Comments are closed.