Loops in Java in Hindi ??? For, While ?????? Do-While ?????? ???????????????
?????????????????? ?????????????????????, ??????????????? Java Programming ??????????????? ????????? ???????????? ?????????????????? ????????? ??????????????? ??????????????? ????????? ???????????? If-else (??????????????? ????????????) ???????????? ????????? ?????? ?????? ???????????????????????????????????? ?????? ???????????? ????????????????????? ???????????????????????? ?????? ???????????? ????????? ????????????????????? ??? Loops in Java in Hindi (???????????????)???
??????????????????, ????????? ????????? ???????????? ???????????? ?????? ???????????? ????????? 1000 ????????? ?????????????????? ?????????, ?????? ???????????? ?????? System.out.println ?????? 1000 ????????? ?????????????????????? ????????????????????? ????????????! ?????? ?????????????????? ??????????????? ???????????? ????????? ?????? Loops ?????? ???????????????????????? ???????????? ???????????? ??????????????? ?????? ????????? ?????? ?????? ???????????? ?????? ????????? ?????? ?????????-????????? (Repeat) ?????? ???????????? ?????????, ?????? ?????? ???????????? ????????? ?????? ?????????????????? ???????????????
What is Loop in Java in Hindi? - ???????????? ????????? ????????? ???????????? ???????
Loop ?????? ???????????? ?????? "????????????" ?????? "????????????"???
???????????????????????????????????? ?????????, Loop ?????? ???????????????????????? ????????? ?????? ?????? ??????????????? ?????? ?????????-????????? ?????? ???????????? ?????? ????????? ???????????? ???????????? ?????? ?????? ?????? ?????? ?????? ?????? ???????????? (Condition) ????????? ??? ?????? ????????????
???????????????:
- ????????? ???????????? ?????? ???????????? ?????????
- ????????? ?????? ????????? ???????????? ?????????
- ???????????????????????? (Repetition) ?????? ???????????????????????? ???????????? ???????????? ???????????? ?????????
Types of Loops in Java in Hindi - ???????????? ????????? ??????????????? ?????? ??????????????????
Java ????????? ??????????????? ????????? ?????? 3 ????????? ?????? ??????????????? ???????????? ?????????:
- For Loop: ?????? ???????????? ????????? ?????? ?????? ????????? ??????????????? ????????? ???????????? ?????? (Fixed iterations) ???
- While Loop: ?????? ???????????? ????????? ??? ?????? ?????? ????????? ??????????????? ????????? ???????????? ??????, ?????? ?????????????????? ????????? ?????????
- Do-While Loop: ?????? ?????? ??????????????? ????????? ?????? ????????? ?????? ?????? ?????? ?????? ????????? ?????? ???????????? ?????????
1. For Loop (???????????? ??????????????????)
?????? ???????????? ?????????????????? ???????????????????????? ???????????? ???????????? ????????? ????????? ??????????????? ?????????????????? (Initialization), ???????????? (Condition), ?????? ???????????????/??????????????? (Increment/Decrement) ?????? ?????? ?????? ???????????? ????????? ???????????? ?????????
Syntax:
for(initialization; condition; increment/decrement){
// ????????? ?????? ?????????-????????? ???????????????
}
Example (1 ?????? 5 ?????? ???????????????):
for(int i = 1; i <= 5; i++) {
System.out.println(i);
}
Output: 1 2 3 4 5
2. While Loop
???????????? ???????????????????????? ?????? ???????????? ????????? ?????? ???????????? iterations ?????? ?????????????????? ???????????? ?????? ????????? ???????????? ???????????????
Syntax:
while(condition) {
// ?????????
}
Example:
int i = 1;
while(i <= 5) {
System.out.println(i);
i++;
}
3. Do-While Loop
?????? While loop ???????????? ?????? ??????, ??????????????? ??????????????? ?????? ????????? ???????????? ????????? ?????? ?????????????????? ?????? ????????? ????????? ????????? ???????????? ????????? ???????????? ???????????? ?????? ?????? ?????? ???????????? ?????????????????? ????????? ?????? ??????????????? ??? ??????, ?????? ????????? ?????? ?????? ?????? ?????? ????????? ???????????? ??????????????????
Syntax:
do {
// ?????????
} while(condition);
Warning: Infinite Loop ???????????? ???????
????????? ???????????? ????????? ?????? ?????????????????? ????????? ?????? ?????? ?????? ????????? ????????? (False) ?????? ???????????? ????????????, ?????? ????????? ????????? ???????????? ?????????????????? ?????? ??????????????? ???????????? ?????????????????? ????????? Infinite Loop ???????????? ????????????
Example:
while(true) { ... }(?????????????????????: ?????? ???????????? ???????????????????????? ?????? ???????????? ?????? ???????????? ?????????)
Conclusion ??? ????????????????????????
???????????? ?????????????????? ?????? ?????? ?????? ??????????????? ?????? ???????????? Loops in Java in Hindi ?????? ??????????????? ?????? ????????? ???????????? ???????????????
????????? ????????????: ????????? ????????? ?????? ?????? 10 ????????? ????????? ???????????? ?????? ?????? For Loop ????????? ????????????, ????????? ???????????? ????????? ?????? While Loop ????????? ???????????????
???????????? ??????????????? ????????? ?????? "Break and Continue" ?????? ???????????? ????????? ??????????????????, ??????????????? ?????? ?????? ??????????????? ?????? ????????? ????????? ?????? ????????? ?????????????????????
FAQs
Q1. While ?????? Do-While ????????? ???????????? ???????????? ???????
Ans: While ???????????? ?????????????????? ????????? ???????????? ?????? (Entry Controlled), ???????????? Do-While ????????? ????????? ?????????????????? ????????? ???????????? ?????? (Exit Controlled) ???
Q2. ???????????? ????????? ????????? ????????? ?????? ???????
Ans: ??????????????? ?????? ??????????????? ????????? ??????????????? ???????????? ??????????????? ?????????, ?????? ???????????? ??????????????? ?????? ?????????????????? ???????????? ?????????
Q3. Infinite Loop ?????? ???????????? ????????????????
Ans: ????????????????????? ?????? Ctrl + C ??????????????? ?????? ????????? ?????? ???????????????????????? ????????? ???????????? ????????????