随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

//定义
type
  Ten = 1..10;
  OverHundred = 100..1000;
  Uppercase = 'A'..'Z';
  //TMonth = Jan..Dec;

//应用 var UppLetter: UpperCase; begin UppLetter := 'F';
//判断是否属于子界范围 var i: Integer; begin i := 1; if i in [0..10] then ShowMessage('i 大于0、小于10'); end;
//根据枚举定义子界 type TColors = (Red,Blue,Green,Yellow,Orange,Purple,White,Black); TMyColors = Blue..Yellow; var MyColor: TMyColors; begin MyColor := Blue; ShowMessage(IntToStr(Ord(MyColor))); //1 end;
//遍历子界 var character: 'a' .. 'z'; s: string; begin for character in [Low(character) .. High(character)] do begin s := s + character; end; ShowMessage(s); //abcdefghijklmnopqrstuvwxyz end;
posted on 2007-11-30 18:00  万一  阅读(...)  评论(...编辑  收藏