Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# do while loop

do {
   statement(s);
} while( condition );
_______________EX.___________________
int i = 0;

do
{
	Console.WriteLine(i);
	i++;
}
while (i < 5);

============OUTPUT======================
  0
  1
  2
  3
  4
Comment

do while loop in c#

# plz suscribe to my youtube channel -->
# https://www.youtube.com/channel/UC-sfqidn2fKZslHWnm5qe-A

do {
  Console.WriteLine("Emter the magic word");
  magic_string = Console.ReadLine();
  if(magic_string != "please");{
	 Console.WriteLine("{0} is not the corret magic word try again:- ",magic_string );
  }
}while ( magic_string != "please");
Comment

c# do while

do
{
	//Code here (will run at least once)
} while (true); //Condition to test for here
Comment

while c#

int repeats = 0; 
bool while = true; //creates a bool variable with the true value
while (while = true) //repeats the code in the curly brackets as long
{                    //as the value in the round brackets remains true
   repeats++; //increase the value inside repeats
}
Comment

C# while loop

int i = 1;
while(i != 0)
{
	//This code will loop
	Console.WriteLine("Say a number");
	i = int.Parse(Console.ReadLine());
}
Comment

while c#

int i = 0; // initialization

while (i < 10) // condition
{
    Console.WriteLine("i = {0}", i);

    i++; // increment
}
Comment

c# while loop

while(condition) 
{
   statement(s);
}
_______________EX.___________________
int a = 0;
while (a < 10)
{
	Console.WriteLine(a); //output>> 0 .. 1 .. 2 ........ 8 .. 9
	a++;
}
Comment

c# do while or

int sugar = 0;
int salt = 0;

do {
    bottle1.choose();
    bottle2.choose();
    if ((bottle1 == 'Sugar') && (bottle2 == 'Sugar'))
    {
        Console.Write("Sugar");
        sugar++;
    }
    else if ((bottle1 == 'Salt') && (bottle1 == 'Salt'))
    {
        salt++;
        Console.Write("Salt");
    }
    else
    {
        Console.Write("None");
    }
} while ((salt < 10) || (sugar < 10));
Comment

c# while true loop

while (true)//the "true" keyword mean it will run forever, you can change it too (example while (i > 3))
{
	//Code here
    System.Threading.Thread.Sleep(100) // Convertion: 1000 = 1 second
    //if you are using a while true statment, your program will frezze without this Sleep keyword
}
Comment

do while loop in c#

do
{
    //code block


} while(condition);
Comment

C# While Loops

int index = 1;
while (index <= 5)
{
    Console.WriteLine(index);
    index++;
} 

    Console.ReadLine();
Comment

c sharp while statement

public bool cando = true;

while (cando) // will run if cando stays true
{
    //code
    break; //here we break the while loop. it will not run anymore(we do this bc there is no really different option to break the cando bool)
}    
Comment

While loop in c#

int i = 0;
while (i < 20) 
{
  Console.WriteLine(i);
  i++;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# sort array by value 
Csharp :: bezier_curve 
Csharp :: access denied tring to save a file uwp xamarin 
Csharp :: Reporting Progress from Async Tasks c# 
Csharp :: how to use date range picker in asp.net C# 
Csharp :: unity move camera to player fluent 
Csharp :: .net core web api save pdf file in local folder 
Csharp :: change tab to enter in c# form 
Csharp :: Unity Input Key Message 
Csharp :: how to make diagonal movement not double the speed of the player in unity 
Csharp :: how to solo squad in fortnight 
Csharp :: ef save changes 
Csharp :: Calculate relative time in C# 
Csharp :: c# Class instance 
Csharp :: get one parameter from list in an new list c# 
Csharp :: messagebox error c# 
Csharp :: how to get user browser information in .net core 
Csharp :: set ByteArrayContent content type json 
Csharp :: parse error message: could not create type webservice.webservice asp .net 
Csharp :: how to fill dictionary in c# 
Csharp :: c# generate random date of birth but over 18 
Csharp :: qget ViewSchedule revit api 
Csharp :: take out substring from string 
Csharp :: c# load button image from resource 
Csharp :: openxml row count 
Csharp :: image into sql database 
Csharp :: #StopRape 
Csharp :: c# read file while writing 
Csharp :: how to preset an array c# 
Csharp :: how to change the scale of a gameobject in unity 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =