SlideShare a Scribd company logo
1 of 3
Download to read offline
หลักการตั้งชื่อตัวแปร
ขึ้นต้นด้วยตัวอักษร เท่านั้น
ห้ามซํ้ากับคําสงวน (Reserved Word) เช่น string
ตัวอักษรแรกของคําต่อไป ควรใช้ตัวอักษรพิมพ์ใหญ่
ควรตั้งชื่อให้สื่อความหมาย และสามารถบอกชนิดตัวแปรได้
ตัวแปร ตัวดําเนินการ
ตัวดําเนินการเปรียบเทียบ
ตัวแปร ตัวดําเนินการ
ตัวดําเนินการ คําอธิบาย
ตัวอย่าง
เมื่อ a = 5, b = 3
ผลลัพธ์ที่ได้
== เท่ากับ a == b False
!= ไม่เท่ากับ a != b True
< น้อยกว่า a < b False
<= น้อยกว่า หรือเท่ากับ a <= b False
> มากกว่า a > b True
>= มากกว่า หรือเท่ากับ a >= b True
ผลลัพธ์ที่ได้มี 2 ค่า คือ จริง (True) กับ เท็จ (False) เท่านั้น
ตัวดําเนินการทางตรรกศาสตร์
ตัวแปร ตัวดําเนินการ
ตัวดําเนินการ คําอธิบาย
ตัวอย่าง
เมื่อ a = True
b = False
ผลลัพธ์ที่ได้
! นิเสธ
(Negation)
!a False
&& และ (And) a && b False
|| หรือ (Or) a || b True
^ Exclusive Or a ^ b True
ผลลัพธ์ที่ได้มี 2 ค่า คือ จริง (True) กับ เท็จ (False) เท่านั้น

More Related Content

More from Naruemon Soonthong

ข้อมูล ตัวแปร ตัวดำเนินการ
ข้อมูล ตัวแปร ตัวดำเนินการข้อมูล ตัวแปร ตัวดำเนินการ
ข้อมูล ตัวแปร ตัวดำเนินการNaruemon Soonthong
 
กำหนดค่า Link label
กำหนดค่า Link labelกำหนดค่า Link label
กำหนดค่า Link labelNaruemon Soonthong
 
การสร้างเมนู ด้วย Menu strip
การสร้างเมนู ด้วย Menu stripการสร้างเมนู ด้วย Menu strip
การสร้างเมนู ด้วย Menu stripNaruemon Soonthong
 
คู่มือการใช้โปรแกรมเครื่องคิดเลข
คู่มือการใช้โปรแกรมเครื่องคิดเลขคู่มือการใช้โปรแกรมเครื่องคิดเลข
คู่มือการใช้โปรแกรมเครื่องคิดเลขNaruemon Soonthong
 
คู่มือการใช้โปรแกรมเครื่องคิดเลข
คู่มือการใช้โปรแกรมเครื่องคิดเลขคู่มือการใช้โปรแกรมเครื่องคิดเลข
คู่มือการใช้โปรแกรมเครื่องคิดเลขNaruemon Soonthong
 
Setup Project in Visual Studio C#
Setup Project in Visual Studio C#Setup Project in Visual Studio C#
Setup Project in Visual Studio C#Naruemon Soonthong
 
คะแนนเก็บภาคเรียนที่ 1/2558
คะแนนเก็บภาคเรียนที่ 1/2558คะแนนเก็บภาคเรียนที่ 1/2558
คะแนนเก็บภาคเรียนที่ 1/2558Naruemon Soonthong
 
Eis m1 02principle of computer(2)
Eis m1 02principle of computer(2)Eis m1 02principle of computer(2)
Eis m1 02principle of computer(2)Naruemon Soonthong
 
Eis M1 01 principle of computer(1)
Eis M1 01 principle of computer(1)Eis M1 01 principle of computer(1)
Eis M1 01 principle of computer(1)Naruemon Soonthong
 

More from Naruemon Soonthong (18)

Register Animaker
Register AnimakerRegister Animaker
Register Animaker
 
IT Q & A
IT Q & AIT Q & A
IT Q & A
 
ข้อมูล ตัวแปร ตัวดำเนินการ
ข้อมูล ตัวแปร ตัวดำเนินการข้อมูล ตัวแปร ตัวดำเนินการ
ข้อมูล ตัวแปร ตัวดำเนินการ
 
กำหนดค่า Link label
กำหนดค่า Link labelกำหนดค่า Link label
กำหนดค่า Link label
 
Setup project (csharp)
Setup project (csharp)Setup project (csharp)
Setup project (csharp)
 
การสร้างเมนู ด้วย Menu strip
การสร้างเมนู ด้วย Menu stripการสร้างเมนู ด้วย Menu strip
การสร้างเมนู ด้วย Menu strip
 
คู่มือการใช้โปรแกรมเครื่องคิดเลข
คู่มือการใช้โปรแกรมเครื่องคิดเลขคู่มือการใช้โปรแกรมเครื่องคิดเลข
คู่มือการใช้โปรแกรมเครื่องคิดเลข
 
คู่มือการใช้โปรแกรมเครื่องคิดเลข
คู่มือการใช้โปรแกรมเครื่องคิดเลขคู่มือการใช้โปรแกรมเครื่องคิดเลข
คู่มือการใช้โปรแกรมเครื่องคิดเลข
 
Setup Project in Visual Studio C#
Setup Project in Visual Studio C#Setup Project in Visual Studio C#
Setup Project in Visual Studio C#
 
switch case
switch caseswitch case
switch case
 
็Hello World! in C#
็Hello World! in C#็Hello World! in C#
็Hello World! in C#
 
Review Csharp
Review CsharpReview Csharp
Review Csharp
 
คะแนนเก็บภาคเรียนที่ 1/2558
คะแนนเก็บภาคเรียนที่ 1/2558คะแนนเก็บภาคเรียนที่ 1/2558
คะแนนเก็บภาคเรียนที่ 1/2558
 
It1
It1It1
It1
 
M5 2 event driven programming
M5 2 event driven programmingM5 2 event driven programming
M5 2 event driven programming
 
Introduction to c sharp
Introduction to c sharpIntroduction to c sharp
Introduction to c sharp
 
Eis m1 02principle of computer(2)
Eis m1 02principle of computer(2)Eis m1 02principle of computer(2)
Eis m1 02principle of computer(2)
 
Eis M1 01 principle of computer(1)
Eis M1 01 principle of computer(1)Eis M1 01 principle of computer(1)
Eis M1 01 principle of computer(1)
 

หลักการตั้งชื่อตัวแปร