From e7fd282cdeb756a29f95adf10ca7fbd8791cd157 Mon Sep 17 00:00:00 2001 From: Cory Harkins Date: Sun, 28 Oct 2018 13:25:10 -0400 Subject: [PATCH] Note on getting caught in while loops. (#20230) --- guide/english/csharp/while-loop/index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guide/english/csharp/while-loop/index.md b/guide/english/csharp/while-loop/index.md index 5ddb36a4fc..328c1281f4 100644 --- a/guide/english/csharp/while-loop/index.md +++ b/guide/english/csharp/while-loop/index.md @@ -27,7 +27,7 @@ while (i < 5) ## Other Uses -The while loops is often used for infinite iterrations by using (for example) `while (true)`, only to be ended through a condition unrelated to the initial condition of the loop. +The while loops is often used for infinite iterrations by using (for example) `while (true)`, only to be ended through a condition unrelated to the initial condition of the loop. Be careful to not get stuck in an infinite loop when using while loops in this manner. ```csharp @@ -49,6 +49,7 @@ while (true) The biggest differences between the `for` and `while` loops is that `while` is typically used when a developer is not sure of an exact number of iterations of the loop, and `for` is used when it's clear how many times to iterate through code. + ### Sources * [Microsoft C# - while](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/while)