C# nested while loops and multiple conditions

C# nested while loops and multiple conditions

Today, We want to share with you C# nested while loops and multiple conditions.
In this post we will show you Nested loops in C# programming, hear for c# while true Check we will give you demo and example for implement.
In this post, we will learn about c# while loop multiple conditions with an example.

Nested while Loop in C#

Syntax for Nested while Loop in C#:

while (condition)
{
    while (condition)
    {
        your statements;
    }
    your statements;
}

Nested loops in C# programming

while ((!mystring.Contains("pakainfo")) || (NewData != OldData) || (totalcount < 100))
{
    //while at least more to one those right conditions is true, then  this while loop will work
}

Is logically equivalent to your

while ((v3.IsAlive) || ((v2.IsAlive) || v1.IsAlive))
//do stuff
jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

die when v3 ends or when both v2 and v1 end

while (v3.IsAlive || v2.IsAlive || v1.IsAlive)
//do stuff

Example 1: C# program of Nested while Loop

using System;
namespace loop
{
    class Wprogram
    {
        static void Main(string[] args)
        {
            int startpoint = 5;
            while (startpoint >= 1)
            {
                int j = 5;
                while (j >= startpoint)
                {
                    Console.Write(j);
                    j--;
                }
                startpoint--;
                Console.WriteLine();
            }
            Console.Read();
        }
    }
}

OutPut : C# program of Nested while Loop

5
54
543
5432
54321

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about C Sharp Looping with do and while Statements.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment