
<자료형> <변수이름>;
int num;
// 한번에 변수 여러개를 선언할 수 있다.
int num1, num2, num3;
<변수이름> = <값>;
int num; // 변수 선언
num = 10; // 변수 초기화
int num = 10; // 변수 선언과 동시에 초기화
// 한번에 여러개의 변수를 초기화
int num1 = 10, num2 = 20, num3 = 30;
int health;
string playerName;
bool isDead
bool isPurchased
abstract as base bool break byte case catch char checked
class const continue decimal default delegate do double else enum
event explicit extern false finally fixed float for foreach goto
if implicit in int interface internal is lock long namespace
new null object operator out override params private protected public
readonly ref return sbyte sealed short sizeof stackalloc static string
struct switch this throw true try typeof uint ulong unchecked
unsafe ushort using virtual void volatile while
리터럴은 프로그램에서 직접 사용되는 상수 값으로, 컴파일러에 의해 처리되며 변수나 상수에 할당되거나 연산에 사용된다.
C#에서는 다양한 종류의 형식으로 표현되며 다양한 값의 범위를 가지고 있다.
int i = 10;
float f = 3.14f;
char c = 'A';
string str = "Hello, World!";
long num3 = 100000000000000L;