p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning C# 6.0 Programming with Visual Studio 2015 (http://p2p.wrox.com/forumdisplay.php?f=798)
-   -   Chapter03 (http://p2p.wrox.com/showthread.php?t=98498)

BraneTronics January 28th, 2016 01:40 AM

After reading the third chapter, I feel like a cherry dipped in molten chocolate. I mean it might take some time to soak up all the information, but the authors gave it all. Thanks guys.

Cruisin... through.

workNhard February 13th, 2016 03:02 PM

Errata - code error on page 155
I didn't see the errata posting area for this book so I thought I would post it here.

The code on p. 155 ...


int i = 1;
  WriteLine("{0}", i++);
} while (i <= 10);

should be ....


int i = 1;
    WriteLine($"{i}", i++);
} while (i < 10);

BraneTronics February 14th, 2016 07:17 PM

No problem with the code!
First of all the code that you mentioned is in page 67 of my printed version of the book. Weird??? I don't see any problem with the code you mentioned either. The authors are trying to explain how the do...while loop works. The code in the book prints numbers 1 to 10 like it is supposed to.

If you are confused by the use of "{0}", i++ instead of $"{i}",i++ then both of these are valid C# code. Use of $"{i}",i++ being the latest C# 6.0 feature.

Try copying the code within -------- in visual studio and try it out.
using System;

namespace ConsoleApplication
class Program
static void Main(string[] args)
int i = 1;
} while(i <= 10);

// Prints out

Hope this helps you understand how do...while loop works! [:)]

FittyFrank October 8th, 2016 12:03 AM

Ch. 3 Exercises
Hi all, I think the answer in the appendix to exercise 3.5 is incorrect.
By considering operator precedence, list the steps involved in the computation of the following expression:
resultVar += var1 * var2 + var3 % var4 / var5;

The precedence shown using parentheses in Appendix A is:
resultVar += (((var1 * var2) + var3) % (var4 / var5));

I believe the answer should be:
resultVar + ((var1 * var 2) + ((var3 % var4) / var5))

To me it seems as though the answer in the appendix gives preference to an addition operation over the % operation which is incorrect. It's late at night so I might just be sleepy, but feel free to take a look.

All times are GMT -4. The time now is 05:05 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.