±`¼Æ(Constants)

±z¥i¥H±q¥»¤å¤¤±oª¾¦³Ãö±`¼Æ(constant)ªº»yªk¡A¥H¤Î¨Ï¥Îªº®É¾÷¡C
±`¼Æ«Å§i(constant declaration)
¤@­Ó©T©w¤£Åܪº­È¡A§Ú­ÌºÙ¤§¬° "±`¼Æ"¡C¤@¯ë§Ú­Ì¦bµ{¦¡¤¤·|¥Î¨ì¤@¨Ç©T©wªº¤å¦r©Î¼Æ¦r¡A´N¬O¹³ 100¡B'a'¡B3.1415926 ¡K¡A¦b³oùاڭ̭n±´°Qªº¡A´N¬O¦p¦ó¥ÎÃѧO¦r¡A¨Ó¨ú¥N³o¨Ç¯u¥¿ªº¼Æ­È¡C
¦b¨Ï¥Î±`¼Æ«e¡A¥²»Ý¥ý¦bµ{¦¡ªº¶}ÀY«Å§i¡A§i¶DDelphi³o¨ÇÃѧO¦r¥Nªí±`¼Æ¡C±`¼Æ¦b«Å§i¤§«á¡A´N¤£¥i¥H¦A§ïÅܳo­Ó­È¤F¡C
Åý§Ú­Ì¥ý¬Ý¬Ý±`¼Æ«Å§iªº¨Ò¤l:
const
PI=3.1415926 ;
Digit=['0'..'9'] ;
OneDay=60 * 60 * 24 ;
HalfDay=OneDay / 2 ;
IntSize=sizeof(integer) ;
DiskFullMessage='ºÏºÐªÅ¶¡¤wº¡!' ;
ChangeDiskMessage='½Ð´«·sªººÏ¤ù' ;
WarningMessage=DiskFullMessage+' '+ChangeDiskMessage ;

¦b¤@¶}©lªº¦a¤è¡A§Ú­Ì¥Hconst³o­Ó«O¯d¦rªí¥Ü¤§«á¬O±`¼Æªº«Å§i¡CÃѧO¦r©M­È¤À§O©ñ¦bµ¥¸¹ªº¥ª¥k¨âÃä¡A¨Ã¥H¤À¸¹§@¬°µ²§À¡C§Ú­Ì¤]¥i¥H¦P®É«Å§i¦h­Ó±`¼Æ(¦p¤W¨Ò)¡C
¦]¬°±`¼Æ¬O¦b½sĶ®É¡A´N¤w¸gºâ¥X©T©wªº­È¡A©Ò¥H¦b±`¼Æªº©w¸q¤¤¤£¥i¥H¦³ÅܼƩάO¦ì§}ªº¹Bºâ¡C¦Ó°£¤F¤U­±©Ò¦Cªº¼Ð·Ç¨ç¼Æ¥~¡A¤]¤£¤¹³\¨Ï¥Î¨ç¼Æ©I¥s¡C
¦b±`¼Æ«Å§i¤¤¥i¥Îªº¼Ð·Ç¨ç¼Æ:
abs addr chr hi high
length lo low odd ord
pred round sizeof succ swap
trunc

°£¤F¤W­zªº­­¨î¥~¡A±`¼Æ¤¤ªº¹Bºâ¦¡©M¤@¯ë¹Bºâ¦¡ªº»yªk³W«h¬Û¦P¡A¸Ô±¡½Ð°Ñ¦Ò Obiect Pascal Language Guide ¤¤²Ä¤­³¹ Expressionsªº»¡©ú¡C

°£¤F³oùؤ¶²Ðªº±`¼Æ¥~¡AÁÙ¦³¤@ºØºÙ¬°«¬ºA±`¼Æ(Typed Constants)¡AÁöµM¤@¼Ë¬O¦bconst¤¤«Å§i¡A¦ý¬O¨Ï¥Î¤W¦³ÂI¤£¦P¡A§Ú­Ì±N¦b¥t¤@½g¤å³¹(Type.doc)¤¤¤¶²Ð¡C
¨Ï¥Î®É¾÷
¾A·íªº¨Ï¥Î±`¼Æ¡A¥i¥H²¤Æµ{¦¡ªº¾\Ū¤Î¼W¥[ºûÅ@¤Wªº¤è«K¡C¨Ò¦p­pºâ¶ê©P®Éªº¤½¦¡:
Circumference := 2 * radius * 3.1415926 ;
Circumference := 2 * radius * pi ;

¤W­±³o¨â­Ó¦¡¤l¡A¨Ï¥Î±`¼Æ¥i¥H«Ü©úÅ㪺¬Ý¥X³o­Ó¦¡¤lªº·N¸q¡A¦Ó¥B§ó­«­nªº¡A¦pªG±N¨Ó¥´ºâ­×§ïµ{¦¡¼W¥[ºë±K«×¡A¥u­n¦b±`¼Æ«Å§iªº³¡¥÷§ó§ïpiªº­È

pi=3.141592654 ;

­«·s½sĶ«á¡A´N¥i¥H±N¶ê©Pªººë½T«×¦A´£°ª¨â¦ì¡C§_«h¨ìµ{¦¡¤¤¤@¤@­×§ï©Ò¦³¬ÛÃöªº¹Bºâ¦¡¡A¤£¦ý®e©ö¥X¿ù¤]¨S¦³®Ä²v¡C

¦bµ{¦¡¤¤¤d¸U¤£­n¦³ªº¦a¤è¥Î±`¼Æ¡A¤S¦³ªº¦a¤èª½±µ¨Ï¥Î¼Æ¦r¡A¦]¬°³o¼Ë®e©ö¾É­P¿ù»~¡C§Ú­Ì¨Ï¥Î±`¼Æªº¥Øªº´N¬O¬°¤F´£°ªµ{¦¡ªº¥iŪ©Ê¤ÎºûÅ@¤Wªº¤è«K¡A¤£¤@­Pªº¥Îªk¥u·|³y¦¨²V²c¡C