Total Page Preview:   000000001379

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

 

While loop in C-Sharp in English:

In C#, a while loop is a control structure that repeatedly executes a block of code as long as a specified condition remains true. The basic syntax of a while loop in C# is as follows:

Here, the condition is a Boolean expression that is evaluated before each iteration of the loop. If the condition is true, the block of code inside the loop is executed. This process continues until the condition becomes false.
Here's an example of a while loop in C# that prints the numbers from 1 to 5:
 
In this example, the condition i <= 5 is evaluated before each iteration of the loop. As long as i is less than or equal to 5, the loop will continue to execute. Inside the loop, the current value of i is printed to the console, and then i is incremented by 1 using the i++ operator.
The output of this code will be:
 
 
 
While loop in C-Sharp in Hindi:
While loop C# me ek conditional loop hai, jo ek statement ko baar baar execute karta hai jab tak specified condition true hai. Jab condition false ho jati hai, tab loop execution ruk jati hai aur control loop ke bahar chala jata hai.
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. Agar "condition" true hai to statements block execute hote rahte hai, aur jab "condition" false ho jati hai tab loop execution ruk jata hai.
Yahan ek example hai jo while loop ka upyog karta hai:
 
Is example me, hum ek integer variable "i" initialize karte hai, aur fir ek while loop ka upyog karke "i" ko 1 se 10 tak print karte 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


                           
                           

                           

                           

Facebook User: