+ 2
difference between return and Console.WriteLine
What is the difference between return and Console.WriteLine/Console.Write??
6 Answers
+ 13
Console.WriteLine is used to display some data on the screen.
Return completes the execution of the some function, but it is not necessary that any data will be shown on the screen.
+ 10
You are welcome, @Sabihaš
+ 4
thanks, @NezhnyjVampir
+ 4
@LunarCoffee
I knew the difference of these two. my question was difference between these two and return. Anyhow thanks.
+ 3
Console.Write() prints something to the screen without a newline at the end. Console.WriteLine() adds a newline to the end. In general, Console.WriteLine() is used more. To demonstrate:
[------------------------------------------------]
EXAMPLE 1:
Console.Write("Hello, ");
Console.Write("world!");
OUTPUT:
Hello, world!
[------------------------------------------------]
EXAMPLE 2:
Console.WriteLine("Hello, ");
Console.WriteLine("world!");
OUTPUT:
Hello,
world!
[------------------------------------------------]
Hope that helps! :)
+ 1
Oh, ok.