Important Notice:

The while Loop

The while Loop

37 views 1 min read

The while Loop (व्हाइल लूप)

हिंदी व्याख्या: while loop तब इस्तेमाल होता है जब हमें condition पहले चेक करनी हो। अगर condition सही है तो लूप चलेगा।

English Explanation: The while loop checks the condition first. The loop runs only if the condition is true.

Syntax:

while (condition) { // code }

उदाहरण:

JavaScript
 
let i = 1; while (i <= 5)
{ document.write("Value of i:", i);
 i++;
}
Output:-
Value of i: 1 Value of i: 2 Value of i: 3 Value of i: 4 Value of i: 5

 

Related Notes