0
What is exactly the function of "Console.WriteLine"?
Any codeline that comes after the first console.writeline doesn't print on the console (command prompt) why?
4 Respostas
+ 3
Hi and welcome to the community!
Write.Line() is a function:
Writes the current line terminator to the standard output stream.
Console.WriteLine() is a method:
Writes data, followed by the current line terminator, to the standard output stream.
Basically, what you decide to add as a string will be typen in either output when running the program.
Unfortunately... Sololearn is not supported to this method. The same goes to importing modules or any way to debug.
Hope this helped.
Dr.
+ 1
Do you have sample code?
0
Output goes to the standard output stream "Output Type" (Project > [Project Name] Properties > Application > Output type). select where you want your output to go from the drop down. The System.Console class exposes various methods that I suggest further researching.
0
here is the code sample:
using System;
class OddOrEven
{
static void Main()
{
Console.WriteLine("Please enter a number to see if it is odd or even.");
int number = int.Parse(Console.ReadLine());
if (number % 2 == 0)
{
Console.WriteLine("The number is even");
}
else
{
Console.WriteLine("The number is odd");
}
}
}
for the whole these lines of codes the only output it prints on the console (command prompt) is "Please enter a number to see if it is odd or even"