diff --git a/Errata.md b/Errata.md index 12a6ba3f..31d97ace 100644 --- a/Errata.md +++ b/Errata.md @@ -41,4 +41,5 @@ Zhou Jing | 22 | 1065 - 1066 | Changed 'Thread' to 'Task' and "Application exiti Zhou Jing | 4 | 161 | Fix `input < 9` to `input < 0` in Listing 4.24 Zhou Jing | 4 | 119 | Show inconsistent size multi-dimensional array in listing 3.16 Zhou Jing | 3 | 114 | Replace `second` with `third` in "// Retrieve third item from the end (Python)" -Tyler Woody | 13 | 702 | Remove the `!` negation in `string.IsNullOrWhiteSpace(input)` in the while loop to properly allow looping \ No newline at end of file +Tyler Woody | 13 | 702 | Remove the `!` negation in `string.IsNullOrWhiteSpace(input)` in the while loop to properly allow looping +Benjamin Michaelis | 19 | .. | Add a `(` before the `next + 1` to complete the parenthesis. \ No newline at end of file diff --git a/src/Chapter19/Listing19.02.PollingATask.cs b/src/Chapter19/Listing19.02.PollingATask.cs index 186b31f8..7a299378 100644 --- a/src/Chapter19/Listing19.02.PollingATask.cs +++ b/src/Chapter19/Listing19.02.PollingATask.cs @@ -1,9 +1,9 @@ -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_02; +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_02; #region INCLUDE using System; using System.Threading.Tasks; -using AddisonWesley.Michaelis.EssentialCSharp.Shared; +using AddisonWesley.Michaelis.EssentialCSharp.Shared; // EXCLUDE public class Program { @@ -17,10 +17,10 @@ public static void Main() #endregion HIGHLIGHT () => PiCalculator.Calculate(100)); - foreach( + foreach ( char busySymbol in Utility.BusySymbols()) { - if(task.IsCompleted) + if (task.IsCompleted) { Console.Write('\b'); break; @@ -55,15 +55,15 @@ public static IEnumerable BusySymbols() { string busySymbols = @"-\|/-\|/"; int next = 0; - while(true) + while (true) { yield return busySymbols[next]; - next = next + 1) % busySymbols.Length; + next = (next + 1) % busySymbols.Length; yield return '\b'; } } } - #region EXCLUDE +#region EXCLUDE */ #endregion EXCLUDE #endregion INCLUDE