案例示例:
function GetDayNameBr(Num: Integer): String;
begin
case Num of
1: Result := 'Domingo';
2: Result := 'Segunda';
3: Result := 'Terça';
4: Result := 'Quarta';
5: Result := 'Quinta';
6: Result := 'Sexta';
7: Result := 'Sábado';
end;
end;
常量数组示例:
function GetDayNameBr(Num: Integer): String;
const
DayNames: array [1..7] of String = (
'Domingo',
'Segunda',
'Terça',
'Quarta',
'Quinta',
'Sexta',
'Sábado');
begin
Result := DayNames[Num];
end;