Professional Documents
Culture Documents
3 C Basic Language
3 C Basic Language
Language
Console.Write()
- puts text on the console window. The Write() method
outputs one or more values to the screen without a new
line character.
Example:
Console.Write(“Hello World”);
Output Statement
Console.WriteLine()
- renders a line of text on the console. It is a useful
Console method. In its simplest form it outputs the string
argument with a trailing newline.
The WriteLine() always appends a new line character to
the end of the string. this means any subsequent output
will start on a new line.
Example:
Console.WriteLine(“Hello World”);
Note: You can apply escape sequence \n (for new line) and \t (for tabbing).
Workshop:
Console.Read( )
is used to read just a single character.
Console.ReadLine( )
reads input from the console.
Comments
- are used for explaining code. Compilers ignore the
comment entries. Comments are a very useful way to
remind yourself what the programme does, or what a
particular part of your code is for.
Symbols:
// - single line comments.
/* */ - multiline comments.
Sample Program: