What does that mean? | SoloLearn: Learn to code for FREE!

0

What does that mean?

Hello, This is the code I have a problem with Random rnd = new Random(); for (uint ctr = 1;ctr <=10;ctr++) console.WriteLine($"{rnd.Next(),15:NO}"); I don't understand the (15:NO) part, what's the use of this code I found it on this website:: https://docs.microsoft.com/de-de/dotnet/api/system.random.next?view=netframework-4.8

3/11/2020 2:29:35 PM

Michael

4 Answers

New Answer

+4

15 means field width, the output is left justified. N means use of currency format and 0 means no precision. If you remove 0, the output will be like 1,2345.00 with 0 it will be like 1,2345 Also see this link http://referencedesigner.com/tutorials/csharp/csharp_6.php

+1

i did some experiment with it. 15 means a width of 15 character, if the number less than 15 digits fill the leftside with space. kindalike setw in c++. N0 means format as number with 0 decimal place.

+1

Hi Michael, Next time please, avoid writing question into the thread's tags.

+1

thanks for the answers