Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.09.30;
Скачать: CL | DM;

Вниз

Constant expression violates subrange bounds   Найти похожие ветки 

 
nil_pointer   (2007-09-01 17:19) [0]

Почему это возникает?

procedure test1(const mytest: string);
begin
 Result := IntToStr(mytest) in [0..9, 10000..20000];
end;


 
Джо ©   (2007-09-01 17:27) [1]

Во-первых, Result в процедуре не может быть употреблен.
Во-вторых, IntToStr принимает в качестве аргумента Integer, а на выходе дает Str. А не наоборот.
В-третьих, [0..9, 10000..20000] — set. И:
The range of a set type is the power set of a specific ordinal type, called the base type; that is, the possible values of the set type are all the subsets of the base type, including the empty set. The base type can have no more than 256 possible values, and their ordinalities must fall between 0 and 255.
(с) Хелп.


 
Anatoly Podgoretsky ©   (2007-09-01 17:36) [2]

> Джо  (01.09.2007 17:27:01)  [1]

Три ошибки в одной строке :-)


 
Leonid Troyanovsky ©   (2007-09-01 17:39) [3]


> nil_pointer   (01.09.07 17:19)  

> procedure test1(const mytest: string);


Solve:

function test1(const mytest: Longint): Boolean;
begin
case mytest of
  0..9, 10000..20000:
    Result := True;
else
  Result := False;
end;
end;

if test1(StrToInt("..")) then

--
Regards, LVT.



Страницы: 1 вся ветка

Текущий архив: 2007.09.30;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.021 c
2-1188226449
ares18
2007-08-27 18:54
2007.09.30
Про глюки XOR алгоритма


15-1188567470
Kolan
2007-08-31 17:37
2007.09.30
Целые числа в object inspector е можно задавать буквами&#133


6-1170415405
inex
2007-02-02 14:23
2007.09.30
переслать результат выполнения в коммандной строке


2-1188891080
6aM6y4a
2007-09-04 11:31
2007.09.30
Дизассемблер


2-1188983561
kyro
2007-09-05 13:12
2007.09.30
Как убрать подчеркивание у label