Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27569

Console.WriteLine() vs Enviroment.NewLine

$
0
0
As a new programmer in Visual Basic today I came across the Enviroment.NewLine function. I am writing a console application in Vb.net and I was wondering what's the different between Enviroment.NewLine and Console.WriteLine().

Visually, the only thing I can see is both produce a new line in the console window. Just Enviroment.NewLine seems to be a more cleaner method in the code?

Here is some sample code for Enviroment.NewLine:

'Welcome message
Console.WriteLine("Welcome to this program.. " & Environment.NewLine)
'Ask to enter first number
Console.WriteLine("Please enter your first number: ")


Here is some sample code for Console.WriteLine():

'Welcome message
Console.WriteLine("Welcome to this program.. ")
Console.WriteLine()
'Ask to enter first number
Console.WriteLine("Please enter your first number: ")


Both do exactly the same thing as far as I can tell.

Viewing all articles
Browse latest Browse all 27569

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>