VitzzViperzz
Well-known member
Hey,
I was just following a book (Worx C# for beginners) and it's been very fun so far. However, it tells us to convert the value of the user's input! After looking at MSDN, it seems it's just better for "efficiency", but is that it?
I would think that there is more to it than that because it seems pointless when writing smaller programs.
Here is the code:
So we declare FirstNumber and Second number as a double.
Then we are converting that to a double again. It seems a little odd, don't you think?
It would be great if someone explained this.
Thanks!
I was just following a book (Worx C# for beginners) and it's been very fun so far. However, it tells us to convert the value of the user's input! After looking at MSDN, it seems it's just better for "efficiency", but is that it?
I would think that there is more to it than that because it seems pointless when writing smaller programs.
Here is the code:
So we declare FirstNumber and Second number as a double.
C#:
double FirstNumber, SecondNumber;
Then we are converting that to a double again. It seems a little odd, don't you think?
C#:
FirstNumber = Convert.ToDouble(Console.ReadLine());
SecondNumber = Convert.ToDouble(Console.ReadLine());
It would be great if someone explained this.
Thanks!