C# is a programming language developed by Microsoft.
-C# is used in many fields , Some of them are:-
--
-
- Desktop App Development -
- Mobile App Development -
- Game Development -
- Backend Web Development -
C# is one of the most popular programming languages , Because:-
--
-
- It is a programming language developed by Microsoft -
- It is a high-level programming language which is easy to learn -
- It is more secure than many programming languages -
- It is close to C , C++ and Java ... It is easy for programmers to switch to C# or vice versa -
Syntax is the structure of statements , Here is a simple program typed in C# to discuss the meaning of syntax
-using System;
+
+
+ Introduction
+ C# is a programming language developed by Microsoft.
+ C# is used in many fields , Some of them are:-
+
+ - Desktop App Development
+ - Mobile App Development
+ - Game Development
+ - Backend Web Development
+
+ C# is one of the most popular programming languages ,
+ Because:-
+
+ - It is a programming language developed by Microsoft
+ - It is a high-level programming language which is easy to
+ learn
+ - It is more secure than many programming languages
+ - It is close to C , C++ and Java ... It is easy for
+ programmers to switch to C# or vice versa
+
+
+
+
+ Syntax
+ Syntax is the structure of statements , Here is a simple
+ program typed in C# to discuss the meaning of syntax
+ using System;
namespace Hello
{
class MyProgram
@@ -60,66 +66,72 @@
}
}
}
-
+ Some data types that are supported by C# :-
--
-
- integer (int) ... 1 , 500 , -200 -
- double (double) ... 0.5 , 3.14 , -2.5 -
- string (string) ... "AAA" , "What is your name ?" -
- character (char) ... 'A' , '+' , '5' -
- boolean (bool) ... true , false -
Some data types that are supported by C# :-
+-
+
- integer (int) ... 1 , 500 , -200 +
- double (double) ... 0.5 , 3.14 , -2.5 +
- string (string) ... "AAA" , "What is your name ?" +
- character (char) ... 'A' , '+' , '5' +
- boolean (bool) ... true , false +
Variables are containers for storing data values.
-The syntax for declaring a variable and assigning a value to it is as following :
-data-type variable-name = value(data) ;
- For example :-
-int age = 20 ;
+
+ Variables
+ Variables are containers for storing data values.
+ The syntax for declaring a variable and assigning a value to
+ it is as following :
+ data-type variable-name = value(data) ;
+ For example :-
+ int age = 20 ;
string FirstName = "AAA" ;
string full_name = "AAA BBB" ;
double _degree = 80.5 ;
char grade = 'A' ;
bool student = true ;
bool male = true ;
-
+ Type casting means turning a certain data from a type to another one.
-Syntax for type casting is :-
-(data-type) data
- For example :-
-double pi = 3.14 ;
+
+ Type Casting
+ Type casting means turning a certain data from a type to
+ another one.
+ Syntax for type casting is :-
+ (data-type) data
+ For example :-
+ double pi = 3.14 ;
int myInt = (int) pi ;
Console.WriteLine(pi) ; // 3.14
Console.WriteLine(myInt) ; // 3
-
+ You already know that Console.WriteLine() is used to output text.
-Now you are going to learn how to use Console.ReadLine() to get user input.
-Console.ReadLine();
- For example :-
-int age ;
+
+ User Input
+ You already know that Console.WriteLine() is used to output
+ text.
+ Now you are going to learn how to use Console.ReadLine() to
+ get user input.
+ Console.ReadLine();
+ For example :-
+ int age ;
Console.Write("Enter your age:") ;
age = Console.ReadLine() ;
Console.WriteLine("You are " + age + " years old") ;
-
+ Booleans are data types that can be used to control whether something is true or false(yes or no / on or off).
-bool male = true ;
+
+ Booleans
+ Booleans are data types that can be used to control whether
+ something is true or false(yes or no / on or off).
+ bool male = true ;
bool student = true ;
bool permission_accepted = false ;
-
-