Case Sensitivity

สำหรับ GDL โดยทั่วไปแล้วตัวอักษร a กับ A นั้นมีความหมายเดียวกัน การพิมพ์คำสั่ง add2 หรือ ADD2 หมายถึงคำสั่งเดียวกัน ยกเว้นในกรณีของ string (ตัวอักษร และ/หรือ ตัวเลขที่อยู่ระหว่างเครื่องหมาย “ ” หรือ ‘ ‘) คำว่า “type 1” จะไม่ถูก GDL ตีความเป็นความหมายเดียวกันกับ “TYPE 1”

Order

การใช้คำสั่ง, statement ใดๆ (command, function, flow control statements, …) ต้องเรียงลำดับ parameter ตามข้อกำหนดเท่านั้น

Indentation

การใช้ย่อหน้า (tab) ในการเขียน GDL นั้น ไม่ได้มีการบังคับไว้ แต่ในทางปฎิบัติ การใช้ย่อหน้านั้นจะมีประโยชน์มากสำหรับ debugging (การหาข้อผิดพลาด) และช่วยให้การอ่าน (และพัฒนา) script ง่ายขึ้น เช่น

แบบที่ 1

! 2D script
add2 1, 1
rot2 45
	if symb_mirrored = 0 then
		text2 0, 0, “Not mirrored”
	else
		text2 0, 0, “Mirrored”
	endif
del 2

แบบที่ 2

! 2D script
add2 1, 1
rot2 45
if symb_mirrored = 0 then
text2 0, 0, “Not mirrored”
else
text2 0, 0, “Mirrored”
endif
del 2

การเขียนทั้ง 2 แบบนั้น ได้ผลลัพธ์ที่เหมือนกัน แต่การเขียนแบบแรกนั้นทำให้อ่าน script ง่ายขึ้น สามารถเห็นว่ามี transformation (add2, rot2) 2 ครั้ง และเห็น if/then ได้ชัดเจนขึ้น

palawat

About the author: indigofigs.com

Leave a Reply

Your email address will not be published. Required fields are marked *