var keyword in C# Last Updated : 22 Jun, 2020 Comments Improve Suggest changes Like Article Like Report Keywords are the words in a language that are used for some internal process or represent some predefined actions. var is a keyword, it is used to declare an implicit type variable, that specifies the type of a variable based on initial value. Syntax: var variable_name = value; Example: Input: a = 637 b = -9721087085262 Output: value of a 637, type System.Int32 value of b -9721087085262, type System.Int64 Input: c = 120.23f d = 150.23m e = G f = Geeks Output: value of c 120.23, type System.Single value of d 150.23, type System.Decimal value of e G, type System.Char value of f Geeks, type System.String Example 1: csharp // C# program for var keyword using System; using System.Text; class GFG { static void Main(string[] args) { var a = 637; var b = -9721087085262; // to print their type of variables Console.WriteLine("value of a {0}, type {1}", a, a.GetType()); Console.WriteLine("value of b {0}, type {1}", b, b.GetType()); } } Output: value of a 637, type System.Int32 value of b -9721087085262, type System.Int64 Example 2: csharp // C# program for var keyword using System; using System.Text; namespace Test { class GFG { static void Main(string[] args) { var c = 120.23f; var d = 150.23m; var e = 'G'; var f = "Geeks"; // to print their type of variables Console.WriteLine("value of c {0}, type {1}", c, c.GetType()); Console.WriteLine("value of d {0}, type {1}", d, d.GetType()); Console.WriteLine("value of e {0}, type {1}", e, e.GetType()); Console.WriteLine("value of f {0}, type {1}", f, f.GetType()); // hit ENTER to exit Console.ReadLine(); } } } Output: value of c 120.23, type System.Single value of d 150.23, type System.Decimal value of e G, type System.Char value of f Geeks, type System.String Comment More infoAdvertise with us Next Article var keyword in C# S shivanisinghss2110 Follow Improve Article Tags : C# CSharp-keyword Similar Reads void Keyword in C# Keywords are the words in a language that are used for some internal process or represent some predefined actions. void is a keyword, it is a reference type of data type and used to specify the return type of a method in C#. It is an alias of System.Void. Syntax: public void function_name([parameter 2 min read short keyword in C# Keywords are the words in a language that are used for some internal process or represent some predefined actions. short is a keyword that is used to declare a variable which can store a signed integer value from the range -32, 768 to 32, 767. It is an alias of System.Int16. Syntax: short variable_n 2 min read ushort keyword in C# Keywords are the words in a language that are used for some internal process or represent some predefined actions. ushort is a keyword that is used to declare a variable which can store an unsigned integer value from the range 0 to 65,535. It is an alias of System.UInt16. Syntax: ushort variable_nam 2 min read Static keyword in C# static is a modifier in C# which is applicable for the following: ClassesVariablesMethodsConstructorIt is also applicable to properties, event, and operators. To create a static member(class, variable, methods, constructor), precede its declaration with the keyword static. When a member is declared 4 min read uint keyword in C# Keywords are the words in a language that are used for some internal process or represent some predefined actions. uint is a keyword that is used to declare a variable which can store an integral type of value (unsigned integer) from the range of 0 to 4,294,967,295. It keyword is an alias of System. 2 min read Like