Total Page Preview:   000000000595

What is do while loop in C-Sharp in English and Hindi

 

Do while loop in C-Sharp in English:

Do while loop in C# is a type of loop which is similar to while loop, but the key difference is that in a do while loop, the condition is checked after executing the code block. This means that the code inside the loop will always execute at least once, regardless of whether the condition is true or false.

Here's the syntax of a do while loop:

 
The code block is executed first, and then the condition is checked. If the condition is true, the loop continues to execute the code block again. If the condition is false, the loop is terminated and control is passed to the next statement in the program.
Here's an example of a do while loop:
 
In this example, we have initialized a variable "i" to 1, and then we have used a do while loop to print the value of "i" from 1 to 10. Since the condition "i <= 10" is true, the loop will execute repeatedly until "i" becomes greater than 10. Once "i" becomes 11, the loop will terminate and control will pass to the next statement in the program.
 

Do while loop in C-Sharp in Hindi:

Do while loop C# me ek conditional loop hai, jo ek statement ko baar baar execute karta hai jab tak specified condition true hai. Ek difference hai while loop ke sath ki do while loop me condition check loop ke baad kiya jata hai, yani loop ko kam se kam ek baar to execute kiya jayega.

Yeh loop kuch is tarah se kaam karta hai:
 
Is loop me "condition" ek expression hai jo true ya false ki value return karti hai. Jab tak "condition" true hai, statements block execute hote rahte hai, aur jab "condition" false ho jati hai tab loop execution ruk jata hai.
Yahan ek example hai jo do while loop ka upyog karta hai:
 
Is example me, hum ek integer variable "i" initialize karte hai, aur fir ek do while loop ka upyog karke "i" ko 1 se 10 tak print karte hai. Loop ke pehle "i" ko 1 se initialize kiya jata hai, aur fir loop body me i ko print karne ke baad 1 se badhaya jata hai. Jab "i" 11 ke barabar ho jata hai, tab condition false ho jati hai aur loop execution ruk jata hai.
 
 
 

 

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com



Comments

Pankaj Singh
09-Mar-2016
nice article its too good for understanding pupose in hindi and english both languages.
Brijesh Kumar
09-Mar-2016
Thank Pankaj.
MANAN
15-Jun-2017
Thanks , For Sharing This Articles Keep sharing and have a great time blogging. Superb Idea.
MANAN
15-Jun-2017
Thanks , For Sharing This Articles Keep sharing and have a great time blogging. Superb Idea.
Soniya Manjani
01-Oct-2016
This is very nice article and easy to understand.

                           
                           

                           

                           

Facebook User: