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.
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.