Keywords, Variables, Constant, Type Casting, Userinputs
Keywords, Variables, Constant, Type Casting, Userinputs
Lecture: 04
WELCOME TO
Fig: C# Keywords
Variables and Constants
Syntax:
datatype variableName = value;
const datatype variableName = value;
Fig: Variable
Type Casting / Type Conversion
Type casting is when you assign a value of one data type to another type.
-- In C#, the simplest method to get input from the user is by using the ReadLine() method
of the Console class. However, Read() and ReadKey() are also available for getting input
from the user. They are also included in Console class.
ReadLine(): The ReadLine() method reads the next line of input from the standard input
stream. It returns the same string.
Read(): The Read() method reads the next character from the standard input stream. It
returns the ascii value of the character.
ReadKey(): The ReadKey() method obtains the next key pressed by user. This method is
usually used to hold the screen until user press a key.
Outputs || Results
-- To output values or print text in C#, you can print or shows any data as outputs.
WriteLine(): You can add as many WriteLine() methods as you want. Note that it will add a
new line for each method.
Write(): There is also a Write() method, which is similar to WriteLine(). The only difference is
that it does not insert a new line at the end of the output
Contact Me
Thank You