-
Notifications
You must be signed in to change notification settings - Fork 0
/
lecture18.html
69 lines (59 loc) · 2.73 KB
/
lecture18.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lecture 18 | While Loops | Do While Loops in javasript |
</title>
</head>
<body>
*****************************Tutorial Start 🔥 ********************************
<h1>While Loops | Do While Loops in javasript</h1>
<h4>While loop</h4>
<p>Repeat the statement code as long as the specified conditions evaluates to true.</p>
<p>while loop me bas aik hi cheez dhyan dena hai voo hai condition, agar condition true hai too while repeat karega,
loop chalega,
and agar condition false hui too loop band ho jayega.
condition true too chalana hai, and agar condition false too rukh jaan hai.
</p>
<script>
//while loop syntax is
while(condition) {
//code to be executed
//block of statement
// ye pura code repeat hoga
//while loop me entry tab hi milegi jab condition true hoga
/* tab tak karna hai jab tak condition false evaluates naa ho jaaye and jab false evaluates
ho tab loop band kar dena hai */
}
</script>
<h4>While loop Flow Chart</h4>
<li>First--> conditions (true or false)</li>
<li>Second--> code of statements executed</li>
<li>Third--> fhir condition check karna hoga</li>
<li>Fourth--> fhir code execute hoga. ye chalta jayega jab tak condition false nhi hota hai.</li>
<h4>do...while loop</h4>
<p>repeat the statement as long as the specified conditions evaluates to true.</p>
<p>isme bhi condition important hai.</p>
<script>
//syntax of do..while loop
do {
//code to be executed
//ye code repeat hoga jab tak ye condition true hoga
}
while(condition);
</script>
<h4>do..while flow chart</h4>
<li>First--> start</li>
<li>Second--> body of loop(code of statements executed repeatedly till condition is true)</li>
<li>Third--> fhir condition check hoga</li>
<li>Fourth--> agar true hua to fhir code of statement execute hoga, and agar false hui too exit.</li>
<h3>Diference beteen while and do..while</h3>
<li>While loop: with a while loop the condition to be evaluated is tested at the beginning of each loop iteration.
so if the conditional expression evaluates to false, the loop will never be executed.</li>
<li>do...while loop: the loop will execute atleast once even if condition is false.</li>
<script src="lecture18.js"></script>
***************************** Tutorial End 🚀 ********************************
</body>
</html>